how to put text under image view

前端 未结 2 2021
清酒与你
清酒与你 2021-01-14 01:02

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 u

相关标签:
2条回答
  • 2021-01-14 01:27

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

    in xml: android:drawableTop

    0 讨论(0)
  • 2021-01-14 01:39

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

        <RelativeLayout
            android:id="@+id/relative"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
    
            <ImageView
                android:id="@+id/imageLabel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:src="@drawable/logonews" />
    
            <TextView
                android: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>
    
    0 讨论(0)
提交回复
热议问题