如何在 android 中的按钮边缘放置文本
how to place text on button at edges in android
我想将文本放在最边缘的按钮中
单击按钮左侧的,然后单击按钮右侧的此处。这是如何实现的。
我使用了 TAGandroid:text="Click Here"
,因为按钮在全屏上,我希望这些词位于极端边缘
使用下面的RelativeLayout
。您可以自定义值。在这里,您可以通过设置 OnClickListener
s.
使所有 RelativeLayout
和 TextView
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>
布局如下:
我想将文本放在最边缘的按钮中 单击按钮左侧的,然后单击按钮右侧的此处。这是如何实现的。
我使用了 TAGandroid:text="Click Here"
,因为按钮在全屏上,我希望这些词位于极端边缘
使用下面的RelativeLayout
。您可以自定义值。在这里,您可以通过设置 OnClickListener
s.
RelativeLayout
和 TextView
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>
布局如下: