给TextView加边框
来源:互联网 发布:2018年云计算展会 编辑:程序博客网 时间:2024/05/01 00:27
写drawable里面的xml文件,里面设置shape来设置文本框的特殊效果。
- <?xml version="1.0" encoding="utf-8"?>
- <shape xmlns:android="http://schemas.android.com/apk/res/android" >
- <!-- 实心 -->
- <solid android:color="@android:color/white" />
- <!-- 边框 -->
- <stroke
- android:width="0.5dp"
- android:color="@android:color/black" />
- <!-- 圆角 -->
- <corners android:radius="3dp" />
- <!-- 边距 -->
- <padding
- android:bottom="10dp"
- android:left="10dp"
- android:right="10dp"
- android:top="10dp" />
- <!-- 渐变 -->
- <gradient
- android:angle="270"
- android:endColor="#FFFF782"
- android:startColor="#13C7AF" />
- </shape>
基本上常用的就这几种了,要达到很好的效果,你需要重新细致的改写里面的数据。
下面是要用到这个shape的LineLayout,在里面设置了3个TextView,没设置对其的方式,默认是向做靠齐的。
- <?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="horizontal" >
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:background="@drawable/tvbar"
- android:text="hello" />
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:background="@drawable/tvbar"
- android:text="hello" />
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:background="@drawable/tvbar"
- android:text="hello" />
- </LinearLayout>
下面是实现的效果。
0 0
- 给TextView加边框
- 给TextView加边框
- 给TextView加边框
- 给TextView加边框
- 给TextView加边框
- 给textview获得焦点时加边框背景
- textview加边框
- textView加边框
- textview加边框
- TextView加边框
- android TextView加边框
- TextView加边框
- TextView 加边框
- 给TextView画边框
- 给TextView添加边框
- 给div加边框
- 给UITextView加边框
- 给图片加边框
- 一篇厚道的Autolayout及VFL经验分享
- SQL: where条件中AND、OR运算符的组合使用
- 金蝶产品培训
- Textview属性
- http的chunked方式
- 给TextView加边框
- Linux中断(interrupt)子系统之四:驱动程序接口层 & 中断通用逻辑层
- 2014年24段魔尺变三叶花视频教程
- C语言_循环语句
- Linux中断(interrupt)子系统之五:软件中断(softIRQ)
- 汽车驾驶模拟器_汽车驾驶模拟器的分类
- vs2012编译libcurl-7.38.0
- 【Python Challenge-1】trans
- SQLite ALTER TABLE命令