圆角边框,渐变背景的Textview
来源:互联网 发布:js手册中文版 编辑:程序博客网 时间:2024/05/22 10:22
在默认情况下,TextView是不带边框的,如果想为Textview添加边框,只能通过为它设置一个背景Drawable,改Drawble只是一个边框,这样就实现了带边框的TextView
第一步:创建shape XML文件 border.xml
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"> <!--设置背景颜色为橙色--><solid android:color="#daa447"></solid> <!--设置边框颜色为红色--> <stroke android:width="4dp" android:color="#f00"></stroke></shape>
第二步 在TextView中引入背景border.xml
<TextView android:textSize="50sp" android:background="@drawable/border" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="带边框的文本" />效果图如下:
设置圆角渐变的TextView
第一步:在Drawable创建bg.xml 文件
如下所示
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <!--设置圆角的半径--> <corners android:radius="50dp"></corners> <!--指定使用渐变背景色 颜色从红色-绿色-蓝色--> <gradient android:centerColor="#0f0" android:endColor="#00f" android:startColor="#f00"></gradient></shape>第二步:在TextView中引入
<TextView android:textSize="50sp" android:background="@drawable/bg1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="圆角渐变" />效果图如下:
1 0
- 圆角边框,渐变背景的Textview
- android 圆角边框、渐变背景的TextView
- android 圆角边框、渐变背景的TextView
- 圆角边框,渐变背影的TextView
- TextView属性之圆角And渐变背景
- Android给TextView设置透明背景、圆角边框
- Android给TextView设置透明背景、圆角边框
- 自己设置textview的边框和背景以及圆形背景
- 边框属性,背景属性,渐变
- 设置背景的圆角,边框
- (转)#小美化#Android给TextView设置透明背景、圆角边框
- 代码设置TextView、Button等控件圆角边框背景颜色
- Android 代码设置TextView、Button等控件圆角边框背景颜色
- android TextView 的圆角背景
- android 圆角边框 textview
- silverlight border 边框和背景渐变效果
- Css3 常用选择器 背景 边框 渐变
- flex的边框渐变
- 模板——函数模板
- python的sorted函数对字典按key排序和按value排序
- 欢迎使用CSDN-markdown编辑器
- linux su和sudo命令的区别
- LoadRunner-HPS、TPS、connection、吞吐量、用户数关系
- 圆角边框,渐变背景的Textview
- Leetcode-448. Find All Numbers Disappeared in an Array-思路详解 - C++
- delphi 隐藏指定程序的托盘图标
- Winform dataSet绑定相关控件数据
- angularjs插值字符串
- How to use gnu readline to implement "reset password".
- Android中的网络框架 Volley(一)
- echarts 基本使用
- JS和原生交互原理浅析