《疯狂安卓讲义》P86 -- 实例:圆角边框、渐变背景的TextView
2018-03-12 15:57
477 查看
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <!--指定背景--> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="带边框的文本" android:textSize="24pt" android:background="@drawable/bg_border" />
<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="圆角边框、渐变背景的文本" android:textSize="24pt" android:background="@drawable/bg_border2" /></LinearLayout>
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"> <!--设置背景色为透明色--> <solid android:color="#0000"/> <!--设置红色边框--> <stroke android:width="4px" android:color="#f00"/></shape>
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <!--指定圆角矩形的4个圆角的半径--> <corners android:topLeftRadius="20px" android:topRightRadius="5px" android:bottomRightRadius="20px" android:bottomLeftRadius="5px" /> <!--指定边框线条的宽度和颜色--> <stroke android:width="4px" android:color="#f0f" /> <!--指定使用渐变背景色,使用sweep类型的渐变颜色从红到绿到蓝--> <gradient android:startColor="#f00" android:centerColor="#0f0" android:endColor="#00f" android:type="sweep" /></shape>
<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="圆角边框、渐变背景的文本" android:textSize="24pt" android:background="@drawable/bg_border2" /></LinearLayout>
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"> <!--设置背景色为透明色--> <solid android:color="#0000"/> <!--设置红色边框--> <stroke android:width="4px" android:color="#f00"/></shape>
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <!--指定圆角矩形的4个圆角的半径--> <corners android:topLeftRadius="20px" android:topRightRadius="5px" android:bottomRightRadius="20px" android:bottomLeftRadius="5px" /> <!--指定边框线条的宽度和颜色--> <stroke android:width="4px" android:color="#f0f" /> <!--指定使用渐变背景色,使用sweep类型的渐变颜色从红到绿到蓝--> <gradient android:startColor="#f00" android:centerColor="#0f0" android:endColor="#00f" android:type="sweep" /></shape>
相关文章推荐
- android 圆角边框、渐变背景的TextView
- Android给TextView设置透明背景、圆角边框
- Android给TextView设置透明背景、圆角边框
- Android TextView(圆弧)边框和背景实例详解
- Android给TextView和EditText等控件设置透明背景、圆角边框
- (转)#小美化#Android给TextView设置透明背景、圆角边框
- TextView属性之圆角And渐变背景
- Android给TextView设置透明背景、圆角边框
- Android给TextView设置透明背景、圆角边框
- Android给TextView设置透明背景、圆角边框
- 代码设置TextView、Button等控件圆角边框背景颜色
- 圆角边框,渐变背影的TextView
- 自定义输入dialog,圆角边框,去掉底部黑色背景。去掉editText黄色输入框。
- 给textview获得焦点时加边框背景
- 圆角边框,渐变背景的Textview
- TextView Button 设置圆角背景
- Android TextView边框和背景,以及圆形背景
- android 圆角边框、渐变背景的TextView
- Android Shape Drawable Resources TextView渐变 背景色 圆角
- TextView实现跑马灯效果 以以实现TextView没有边框 设置我们自己的背景