I want to place text in a button on the extreme edges that is Click on the left part of the button and Here on the right part of the button. How this can be achieved.
i have used the TAG android:text="Click Here"
, as the button is on the full screen i want these words to be at extreme edges
Use the below RelativeLayout
. You can customize the values. Here you can make all of the RelativeLayout
and TextView
s act like a button by setting them OnClickListener
s.
<RelativeLayout
android:id="@+id/mybutton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:background="#3983B1" >
<TextView
android:id="@+id/leftButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Click"
android:textColor="#ffffff" />
<TextView
android:id="@+id/rightButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="Here"
android:textColor="#ffffff" />
</RelativeLayout>
The layout looks like:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.