Skip to content Skip to sidebar Skip to footer

How To Put Text Under Image View

I wrote some xml but still cant place the text on the center of the screen as image. I want to put the text after my image. On my xml just trying to put text on the center under th

Solution 1:

If the CompoundDrawable doesn't meet your needs, you may use a RelativeLayout instead of a LinearLayout like this:

<RelativeLayoutandroid:id="@+id/relative"android:layout_width="wrap_content"android:layout_height="wrap_content" ><ImageViewandroid:id="@+id/imageLabel"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:src="@drawable/logonews" /><TextViewandroid:id="@+id/textLabel"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@id/imageLabel"android:layout_centerInParent="true"android:singleLine="true"android:text="Israel News"android:textSize="18sp"android:textStyle="bold" /></RelativeLayout>

Solution 2:

Considered using textview with drawable on top? http://developer.android.com/reference/android/widget/TextView.html#attr_android:drawableTop

in xml: android:drawableTop

Post a Comment for "How To Put Text Under Image View"