xml控件配置属性
android:background="@drawable/shape"
标签
corners ----------圆角
gradient ----------渐变
padding ----------内容离边界距离
size ------------大小
solid ----------填充颜色
stroke ----------描边
注意的是corners的属性bottomLeftRadius为右下角、bottomRightRadius为左下角
shape制作圆角
<Button android:layout_width="160dp" android:layout_height="wrap_content" android:background="@drawable/button_shape" android:text="圆角按钮" />
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="#fff"/> <padding android:top="10px" android:bottom="10px"/> <corners android:radius="16px"/> <stroke android:width="1px" android:color="#000"/> </shape>
shape制作虚线
没有dashGap属性则为实线
<View android:layout_width="match_parent" android:layout_height="5px" android:layout_marginTop="10dp" android:background="@drawable/line_shape" />
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line" > <stroke android:dashGap="3dp" android:dashWidth="8dp" android:width="1dp" android:color="#63a219" /> <size android:height="1dp" /> </shape>
shape制作渐变
<View android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginTop="10dp" android:background="@drawable/gra_shape" />
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <gradient android:angle="270.0" android:endColor="#ffffff" android:startColor="#000000" /> </shape>
相关推荐
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="#55000000"/> android:angle="270" android:type="linear" android:endColor="#...
本文实例讲述了Android开发圆角Button按钮实现过程,分享给大家供大家参考,具体内容如下 需求及效果图: ...shape xmlns:android=http://schemas.android.com/apk/res/android android:shape=rec
首先,在res下面新建一个文件夹drawable,在drawable下面新建三个xml文件:shape_corner_down.xml、shape_corner_up.xml和shape_corner.xml,分别是下面两个角是圆角边框,上面两个角是圆角边框,四个角全部是圆角...
<shape xmlns:android=http://schemas.android.com/apk/res/android> <gradient android:type=[linear | radial | sweep] //共有3中渐变类型,线性渐变(默认)/放射渐变/扫描式渐变 android:angle=...
电阻:RES1,RES2,RES3,RES4;封装属性为axial系列 无极性电容:cap;封装属性为RAD-0.1到rad-0.4 电解电容:electroi;封装属性为rb.2/.4到rb.5/1.0 电位器:pot1,pot2;封装属性为vr-1到vr-5 二极管:封装属性...
<shape xmlns:android="http://schemas.android.com/apk/res/android" > <!-- 圆角 --> android:radius="20dp" android:topLeftRadius="20dp" android:topRightRadius="20dp" android:bottomRightRadius="0...
-<LinearLayout android:background="@drawable/aaa" android:weightSum="1" android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" xmlns:android=...
shape和selector是Android UI设计中经常用到的,比如我们要自定义一个圆角Button,点击Button有些效果的变化,就要用到shape和selector。可以这样说,shape和selector在美化控件中的作用是至关重要的。 1.Shape 简介...
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" > <RelativeLayout xmlns:...
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > android:layout_...
-<LinearLayout android:background="@drawable/aaa" android:weightSum="1" android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" xmlns:android=...
本文实例为大家分享了...<shape xmlns:android=http://schemas.android.com/apk/res/android android:shape=line> <stroke android:dashGap=3dp android:dashWidth=6dp android:width=1dp android:color=#FF
android:layout_below="@+id/displayPhoto" /> android:id="@+id/lastPhoto" android:layout_width="100dp" android:layout_height="wrap_content" android:layout_alignParentStart="true" android:layout_...
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > android:key="settings" android:title="@string/settings" > android:targetClass="com.android.settings.Settings" ...
xmlns:android="http://schemas.android.com/apk/res/android"> android:layout_width="fill_parent" android:layout_height="46.0dip" android:layout_marginBottom="-1.0dip" android:src="@drawab
<shape xmlns:android=http://schemas.android.com/apk/res/android android:shape=rectangle> <!--设置背景色--> <solid android:color=#7457ED> <!--设置圆角--> <corners and
Android 开发 (实验五) 实验题目:... 二、实验内容 组 件 布 局 有 : LinearLayout 、 TableLayout 、 FrameLayout 、 RelativeLayout 三、实验步骤 1、用表格布局完成登录界面 <TableLayout xmlns:android=...
西 安 邮 电 大 学 (计算机学院) 课内实验报告 实验名称: 界面设计:基本组件 专 业: 网络工程 班 级: 姓 名: 学 号: 指导教师: 日 期: 2017年4月20日... 编写布局代码,如下 <LinearLayout xmlns:android = ...
layer-list xmlns:android=http://schemas.android.com/apk/res/android> <!-- 边 --> <shape android:shape=rectangle> <padding android:bottom=2dp android:left=2dp android:rig
xmlns:android="http://schemas.android.com/apk/res/android" android: <item android:duration="130" android:drawable="@drawable/image_loading_01"> <item android:duration="130" android:drawable="@...