我就纳闷了,个圆角边框为什么网上都能写出那么大段的废话,却没有一句直接了当的。
想实现如图右侧输入框的圆角背景,在XML文件中直接这么写:
文件名:ques_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 设置圆角半径 还可分别详细设置上下左右4个圆角-->
<corners android:radius="5dp"/>
<!-- 内部颜色 -->
<solid android:color="@android:color/white"/>
<!-- 边框宽度 边框颜色 -->
<stroke android:width="1dp" android:color="@android:color/darker_gray"/>
</shape>
"第一个密保问题"TextView使用此XML为background
<TextView
android:id="@+id/question1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3.1"
android:padding="10dp"
android:text="@string/first"
android:background="@drawable/ques_bg" />
搞定收工