AttributeSet

1.String getAttributeName(int index)

获取属性名称


2.String getAttributeValue(int index)

获取属性值,如果值是引用资源,则为@+资源ID值

如android:color="@color/white",假设R.color.white为00003322,则getAttributeValue获取的值为“@00003322”


3.int getAttributeResourceValue(int index,int defaultValue)

获取属性资源值,如果值是引用资源,则返回引用资源的id值,如果不是,则返回defaultValue

如android:color="@color/white",假设R.color.white为00003322,则getAttributeValue获取的值为00003322


3.int getAttributeResourceValue(String namespace, String attribute,
                                         int defaultValue)

获取属性资源值,namespace命名空间,attribute属性名,defaultValue默认值

如app:color,则调用getAttributeResourceValue("app","color",0);


5.int getAttributeNameResource(int index)

获取属性资源id值

如属性android:color,返回值为R.attr.color


6.getStyleAttribute()

获取style属性值,相当于getAttributeResourceValue(null,"style",0)


Resource

1.String getResourceEntryName(int resId)

获取资源id对应的名称

如getResourceEntryName(R.color.white),返回"white"


2.String getResourceTypeName(int resId)

获取资源id对应类型
如getResourceEntryName(R.color.white),返回"color"


3.String getResourcePackageName(int resId)

获取资源id对应的包名
如包名为com.example,则getResourcePackageName(R.color.white)返回值为"com.example"


4.String getResourceName(int resId)

获取资源id对应名称,格式为package:type/entry

如包名为com.example,则getResourceEntryName(R.color.white)返回值为"com.example:color/white"


更多相关文章

  1. [Android(安卓)Training视频系列]6.1 Saving Key-Value Sets
  2. (android)关于ListFragment使用
  3. Flutter底部导航栏BottomNavigationBar
  4. 手机安全卫士开发系列(7)——知识点整理(1)
  5. android intent.setDate方法
  6. android 在java代码中动态设置控件的位置和设置片大小
  7. RelativeLayout实现百分比布局
  8. Android(安卓)DSL简介
  9. Android(安卓)5.0以上Button去掉阴影

随机推荐

  1. Android弹出软键盘工具类
  2. Android View转换成图片保存
  3. android之布局LinearLayout
  4. android java 3des加密 ECB/CBC
  5. Android Themes关于totalBar总结
  6. Android五子连珠
  7. android里面 这是个什么错?
  8. Android IPC——(跨进程通信) 详解
  9. [Android]Data Binding2
  10. Android 线程同步 ConditionVariable的用