给TextView加边框
来源:互联网 发布:vb.net 多线程带参数 编辑:程序博客网 时间:2024/05/16 15:56
先写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>
下面是实现的效果。
- 给TextView加边框
- 给TextView加边框
- 给TextView加边框
- 给TextView加边框
- 给TextView加边框
- 给textview获得焦点时加边框背景
- textview加边框
- textView加边框
- textview加边框
- TextView加边框
- android TextView加边框
- TextView加边框
- TextView 加边框
- 给TextView画边框
- 给TextView添加边框
- 给div加边框
- 给UITextView加边框
- 给图片加边框
- 像计算机一样思考
- 求最小生成树,普里姆(Prim)算法
- C++设计模式-----建造者模式\生成器模式
- 序列化和反序列化
- SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"问题解决
- 给TextView加边框
- memcached 的容易命令和Java 使用 memcached 的简单例子
- poj 3467
- 合并两个排序好的链表/链表去重/链式快排
- 项目总结——深入浅出socket网络编程
- 解决Failed to load class "org.slf4j.impl.StaticLoggerBinder"
- Servlet解决中文乱码问题
- Failed to load class "org.slf4j.impl.StaticLoggerBinder".问题解决
- 如何生成可执行的jar包文件