Android开发之shape的使用
来源:互联网 发布:java 时间戳转换为秒 编辑:程序博客网 时间:2024/06/07 03:12
1.效果图:
2.shape文件中各属性的功能
gradient主要设置背景颜色渐变。startColor为起始颜色值,endColor为结束颜色值,angle为渐变角度
padding主要设置组件里内容距离组件内边框的间距
stroke主要设置组件的边框。width为边框宽度,color为边框颜色
corners 设置边框四角弧度
android:radius="8dp"为四角弧度都为8dip
android:bottomLeftRadius="8dip" 边框左下方弧度为8dip
android:bottomRightRadius="8dip 边框右下方弧度为8dip
android:topLeftRadius="8dip" 边框左上方弧度为8dip
android:topRightRadius="8dip 边框右上方弧度为8dip
solid 设置stroke设置的边框以内的颜色
3.XML文件内容 tv_bg_shape.xml
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners
android:radius="8dp"
/>
<gradient
android:startColor="#33CC00"
android:endColor="#666600"
android:angle="45"
/>
<padding
android:left="5dp"
android:top="5dp"
android:right="5dp"
android:bottom="5dp"
/>
<stroke
android:width="1dp"
android:color="#000"
/>
<solid android:color="#44000000" />
</shape>
4.Activity布局文件内容: activity_show.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/activity_bg_wall">
<TextView
android:id="@+id/title_bar"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:layout_alignParentTop="true"
android:gravity="center_vertical|center_horizontal"
android:background="@drawable/bar_bg_red"
android:textSize="20dp"
android:textColor="#fff"
android:text="Shape使用"
tools:context=".ShowActivity" />
<TextView
android:layout_width="fill_parent"
android:layout_height="200dp"
android:layout_below="@+id/title_bar"
android:layout_margin="20dip"
android:background="@drawable/tv_bg_shape"/>
</RelativeLayout>
- Android开发之shape的使用
- Android开发之 shape的使用
- android之Shape的使用
- Android之shape的使用
- Android开发之shape
- Android开发 shape使用
- android开发中 shape的使用
- Android开发shape的简单使用
- android界面设计之shape的使用
- Android之XML的shape使用
- Android之的Shape图形使用
- Android02--Android之Shape的使用
- android开发之shape详解
- Android 样式开发之shape
- android开发之shape详解
- android开发之shape详解
- android开发之shape详解
- Android开发之Shape详解
- 将参数以字符串构造的方式构造sql语句
- fabric简单使用
- 读光大证劵“股指期货微观市场初探—高频数据、交易的解读”笔记
- Spring MVC+Freemarker+Javascript的多语言(国际化i18n/本地化)和主题(Theme)实现
- C#利用NOPI处理Excel的代码
- Android开发之shape的使用
- 九九乘法表
- ScrollView嵌套GridView的解决办法
- 使用boundle在界面间传递对象
- Delegation Pattern
- 【ASP.NET开发】ASP.NET(MVC)三层架构知识的学习总结
- Krux Digital:调查显示用户平均每访问一个页面就会触发56次数据搜集行为
- 大三了,还是纠结
- iOS 数据存储之我见