How would one create a layout with a button on either side of a textview? This is what I’ve got so far:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/left_button"
android:layout_width="72dip"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="left" />
<TextView
android:id="@+id/center_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dip"
android:padding="10dip"
android:text="textview" />
<Button
android:id="@+id/right_button"
android:layout_width="72dip"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="right" />
</RelativeLayout>
The problem here is that the textview is centered. I want the textview to fill the complete space left. I tried setting its android:layout_width to fill_parent and removing the android:layout_centerHorizontal, but then it seems to overlap the buttons.
Step-1
You need create first button in the left of the screen mention
android:layout_alignParentLeft="true"Step-2
create second button in the right of the screen mention
android:layout_alignParentRight="true"Step-3
Now create TextView and mention the it in the right of first buttona and left of second button by mentioning
XML Code