在您的布局中包含 button.xml 并通过给它一个 id 将其用作按钮,或者您也可以将边框设置为按钮以获得相同的结果
按钮.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/border">
<TextView android:id="@+id/skillTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cleaner"
android:textSize="@dimen/abc_text_size_medium_material"
android:textColor="@color/text_grey"
android:layout_margin="@dimen/normal_margin"
android:layout_centerInParent="true"
/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
可绘制/border.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:radius="5dp"
/>
<stroke
android:width="1dp"
android:color="@color/white" />
</shape>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5567 次 |
| 最近记录: |