android - Center textview below image view -
i need center textview below image view. row screenshot getting now:
i need put textview text "30" below image view thumbs hand, , centered. height position fine now.
like this:
this layout file:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#5981b2" android:orientation="vertical" > <imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="2dp" android:src="@drawable/facebook" /> <imageview android:id="@+id/imageview2" android:layout_width="50dp" android:layout_height="50dp" android:layout_alignparentright="true" android:layout_alignparenttop="true" android:src="@drawable/valoracion" /> <textview android:id="@+id/textview3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/imageview2" android:layout_centerhorizontal="true" android:text="30" android:textappearance="?android:attr/textappearancesmall" /> <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_centervertical="true" android:lines="2" android:text="large text" android:textappearance="?android:attr/textappearancelarge" android:layout_torightof="@id/imageview1" /> </relativelayout>
any welcome.
if don't wanna use margins, can behave differently on other screens, example use textview compounddrawable this:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#5981b2" android:orientation="vertical" > <imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="2dp" android:src="@drawable/facebook" /> <textview android:id="@+id/textview3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_centerhorizontal="true" android:text="30" android:drawablepadding="10dp" android:gravity="center" android:drawabletop="@drawable/valoracion" android:textappearance="?android:attr/textappearancesmall" /> <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_centervertical="true" android:lines="2" android:text="large text" android:textappearance="?android:attr/textappearancelarge" android:layout_torightof="@id/imageview1" /> </relativelayout>
Comments
Post a Comment