Is it possible to override the TextView class so that the width and height of the element are equal to the original size of the background image?
(you want to keep the original dimensions of the image and place the text in its center)
Is it possible to override the TextView class so that the width and height of the element are equal to the original size of the background image?
(you want to keep the original dimensions of the image and place the text in its center)
And if you do this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true"/> </RelativeLayout>
Source: https://ru.stackoverflow.com/questions/559720/
All Articles
ImageWiew
aswrap_content
. And the text is centered withRelativeLayout
- tim_taller