Android中自定义TextView的形状
来源:互联网 发布:阜宁网络发言公众平台 编辑:程序博客网 时间:2024/05/22 13:47
基本步骤:
在drawable文件夹下建立一个shape.xml
在drawable文件夹下建立一个shape.xml
shape.xml:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <!-- 填充的颜色 --> <solid android:color="#FF8C2E"/> <!-- 设置按钮的四个角为弧形 --> <!-- android:radius 弧形的半径 --> <corners android:radius="360dip"/> <!-- padding: Button 里面的文字与Button边界的间隔 --> <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /> </shape>在主界面中的main.xml:
<pre name="code" class="html"> <TextView android:id="@+id/agree" android:layout_width="125dp" android:layout_height="50dp" android:background="@drawable/shape" android:gravity="center" android:text="审批通过" android:textColor="@color/black" android:textSize="20sp" /> <TextView android:id="@+id/disagree" android:layout_width="125dp" android:layout_height="50dp" android:background="@drawable/shape" android:gravity="center" android:text="审批不通过" android:textColor="@color/black" android:textSize="20sp" />
注意:在shape文件中,
表示绘制椭圆:
android:shape="oval"
表示绘制线条:
android:shape="line"表示绘制矩形;加上半径,则可以绘制圆角矩形。
android:shape="Rectange"
0 0
- Android中自定义TextView的形状
- Android开发中自定义按钮的形状
- Android中自定义TextView的字体
- Android中shape自定义形状遇到问题
- Android自定义控件-不同形状的ImageView
- android 自定义TextView"会发脾气的TextView"
- Android自定义形状
- Android 自定义形状ImageView
- Android中为TextView增加自定义的HTML标签
- Android中为TextView增加自定义的HTML标签
- Android 在代码中为textview设置自定义的颜色
- Android 自定义textView的typeface
- 自定义形状的ImageView
- Android 左右椭圆形状的ProgressBar 的自定义实现
- Android UI---自定义形状shape
- Android自定义Button/ImageButton形状
- Android UI---自定义形状shape
- Android UI---自定义形状shape
- Reverse Linked List
- Android--MVP设计思想
- iOS 扩展机制category与associative
- android4.4切换横屏的生命周期w
- matlab中mapminmax()函数归一
- Android中自定义TextView的形状
- 年底的总结
- STL_全排列
- 验证码——模板字符识别
- java排序算法
- ubuntu下安装ros出现“无法下载-package.ros.org中某个包-校验和不符”的解决方法
- Linux操作系统安装MongoDB
- POJ 2398 Toy Storage (判断点与直线关系+排序二分计数)
- 事件冒泡