In a relative layout, how to place a textview below an imagebutton and align it to the center of the imagebutton? -
in relative layout, have large imagebutton , have place textview below-center imagebutton. in textview declaration used android:layout_alignleft="@+id/button1
. because button bigger textview, layouts follows:
______imagebutton______ textview_______________
i wanted layout be:
____imagebutton____ _____textview______
how can this?
assuming imagebutton
not fill width of relativelayout
, easiest way might add following textview
:
android:layout_below="@id/button1" android:layout_alignleft="@id/button1" android:layout_alignright="@id/button1" android:gravity="center"
this make text view same width imagebutton
centered text (which may or may not fit needs).
if imagebutton
occupies entire width of relativelayout
, easier case -- can add following textview
:
android:layout_below="@id/button1" android:layout_centerinparent="true"