xml模版,自定义按钮背景
16lz
2021-01-22
xml模版,自定义按钮背景
<?xml version="1.0" encoding="utf-8"?><corners android:bottomleftradius="4dp" android:bottomRightRadius="4dp"android:topLeftRadius="4dp"android:topRightRadius="4dp"/><paddingandroid:bottom="1dp"android:left="1dp"android:right="1dp"android:top="1dp"/><corners android:bottomleftradius="4dp" android:bottomRightRadius="4dp"android:topLeftRadius="4dp"android:topRightRadius="4dp"/><paddingandroid:bottom="1dp"android:left="1dp"android:right="1dp"android:top="1dp"/>
最外层是选择器,里面包含两个item的state_pressed属性会被被点击时触发,true表示显示被点击的item,false是默认值,显示没被点击的里面包含,的shape属性可以控制显示的形状,一般选择 rectangle 矩形或者oval 椭圆,如果希望能成圆形,需要限定高度等于宽度并且大于文本的宽度才行,在节点添加
<size android:width="130dp" android:height="130dp" />
里面包含的内容非常丰富
填充颜色
边线 width:边线宽度 color:颜色 dashWidth:虚线宽度,dashGap:虚线间隔宽度圆角,可以设置四个边角,此时shape是矩形,也可以一次性设置radius
设置宽度和高度
设置内边距
更多相关文章
- 如何在流体宽度旋转木马中的页面之间创建装订线?
- jQuery的宽度、内宽和外宽、高度、内高和外高有什么区别
- 模态的jQuery动态高度宽度
- 当侧面物品具有不同宽度时,保持中间物品居中
- HTML DIV百分比宽度奇奇怪怪的间距产生了?
- 另一个div内的任意宽度的中心div
- 当给出%宽度时,表的主体减少了Head的col 1空间的总空间
- 宽度切换jQuery中的Animate在FireFox中不起作用? [重复]
- css+html实现自适应宽度的菜单学习