android - Align TextView below an ImageButton in a Relative Layout -
i'm having difficulties in aligning center text view below image button though tried property android:gravity="center", first 2 text views aligned in center of corresponding image buttons, 3rd 1 didn't fit here xml code:
<imageview android:id="@+id/view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_centerhorizontal="true" android:scaletype="fitxy" android:background="@null" android:src="@drawable/imageview" /> <imagebutton android:id="@+id/recbook" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignleft="@+id/textviewbook" android:layout_alignparenttop="true" android:layout_marginleft="30dp" android:layout_margintop="107dp" android:background="@null" android:scaletype="fitxy" android:src="@drawable/recipebook" /> <textview android:id="@+id/textviewbook" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/recbook" android:layout_marginleft="33dp" android:text="@string/booktv" android:textappearance="?android:attr/textappearancesmall" /> <imagebutton android:id="@+id/search" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/textviewbook" android:layout_marginleft="60dp" android:layout_torightof="@+id/textviewbook" android:background="@null" android:scaletype="fitxy" android:src="@drawable/search" /> <textview android:id="@+id/textviewsearch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbaseline="@+id/textviewbook" android:layout_alignbottom="@+id/textviewbook" android:layout_marginleft="37dp" android:layout_torightof="@+id/textviewbook" android:text="@string/search" android:textappearance="?android:attr/textappearancesmall" /> <imagebutton android:id="@+id/favorite" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignleft="@+id/recbook" android:layout_centervertical="true" android:background="@null" android:scaletype="fitxy" android:src="@drawable/favorites" /> <textview android:id="@+id/textviewfav" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_="@+id/favorite" android:layout_alignleft="@+id/textviewbook" android:layout_below="@+id/favorite" android:text="@string/favtv" android:textappearance="?android:attr/textappearancesmall" /> </relativelayout>
use relativelayout , utilize this:
<textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/imagebutton" android:layout_centerinparent="true" android:text="text" />
android android-layout
No comments:
Post a Comment