1. reference:参考某一资源ID(使用另一个资源的id)。 (1)属性定义: <declare-styleable name = "名称"> <attr name = "background" format = "reference" /> </declare-styleable> (2) ...
分类:
其他好文 时间:
2016-09-12 18:45:14
阅读次数:
205
零、序 系统自带的View可以在xml中配置属性,对于写的好的Custom View同样可以在xml中配置属性,为了使自定义的View的属性可以在xml中配置,需要以下4个步骤: 通过<declare-styleable>为自定义View添加属性 在xml中为相应的属性声明属性值 在运行时(一般为构 ...
分类:
移动开发 时间:
2016-09-06 18:13:47
阅读次数:
304
一、自定义控件(一) --- 自定义属性TextView
1,定义属性,制作attrs.xml文件;
属性值:
string,color,attr,array,bool,declare-styleable,dimen,drawable,eat-comment,fraction,
integer,integer-array,item,plurals,string-...
分类:
移动开发 时间:
2016-07-19 10:26:54
阅读次数:
328
参考 1 2 3 4 一、自定义view 继承ImageView 文件 value文件夹下 新建attr.xml 复制代码 1 <?xml version="1.0" encoding="utf-8"?> 2 <resources> 3 <declare-styleable name="Shaped ...
分类:
移动开发 时间:
2016-07-14 15:00:03
阅读次数:
322
下载到DragSortListView的源码是不能直接用的,需要做一下配置 布局文件里面添加 xmlns:dslv="http://schemas.android.com/apk/res/包名" 在values文件夹下的attrs.xml文件里添加 <declare-styleable name=" ...
分类:
其他好文 时间:
2016-07-13 20:24:08
阅读次数:
343
1. reference:参考某一资源ID。 (1)属性定义: <declare-styleable name = "名称"> <attr name = "background" format = "reference" /> </declare-styleable> (2)属性使用: <Image ...
分类:
移动开发 时间:
2016-07-08 01:35:35
阅读次数:
270
自定义View: 第一步:创建一个View的实现类, 创建构造器和重写onDraw() 和onMesure()等方法。 第二步:在/res/values/下创建一个attrs文件,添加<declare--styleable/> 第三步:在布局文件中添加命名空间,便于引用在attrs.xml文件中自定 ...
分类:
移动开发 时间:
2016-06-28 23:34:36
阅读次数:
338
如何使用 declare-styleable declare-styleable 定义说明: 1. reference:参考某一资源ID。 (1)属性定义: <declare-styleable name = "名称"> <attr name = "background" format = "ref ...
分类:
其他好文 时间:
2016-05-21 18:53:02
阅读次数:
168
第一种 /MainActivity/res/values/attrs.xml <?xml version="1.0" encoding="utf-8"?><resources> <declare-styleable name="MyCircle"> <attr name="radius" forma ...
分类:
移动开发 时间:
2016-04-12 18:56:01
阅读次数:
257
<?xml version="1.0" encoding="utf-8"?><resources> <declare-styleable name="MyView"> <attr name="radius" format="integer"></attr> </declare-styleable>< ...
分类:
其他好文 时间:
2016-04-10 21:17:28
阅读次数:
124