TextView 添加边框
来源:互联网 发布:php 面向接口编程 编辑:程序博客网 时间:2024/05/17 03:22
先写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添加边框
- Android--为TextView添加边框
- Android--为TextView添加边框
- android 为TextView添加边框
- android 为TextView添加边框
- Android 为TextView 添加边框
- android 为TextView添加边框
- Android--为TextView添加边框
- android 为TextView添加边框
- android 为TextView添加边框
- Textview添加边框方法之一
- android 为TextView添加边框
- Android中为textView添加边框
- android textView添加不同颜色的边框
- 给imageview,textview,button等添加边框
- c语言中没有string类型变量怎么办?没有bool怎么办?
- nyoj 610 定长覆盖 && 贪心问题系列
- HDU 4781 Assignment For Princess(YY乱搞)
- hdu 2167(状态压缩dp)
- 计算机基础知识(一)——进制转换
- TextView 添加边框
- LeetCode::Combinations
- P2P的流媒体开源系统介绍----peercast,myseelite,p2pcenter
- HDOJ 1016 Prime Ring Problem
- windows xp下配置JDK环境变量
- Json.net的简单使用
- 【ACDream】Andrew Stankevich's Contest (23)
- csu-1339: 最后一滴血
- 幂运算的最少乘法次数