获取引用类型的属性值

  private void init(Context context, AttributeSet attrs) {
//int textId = attrs.getAttributeIntValue(NAME_SPACE,"text");
//String string = getResources().getString(textId);
//Log.e("UserViewView", "UserViewView init()" + textId); TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.UserViewView); int resourceId = ta.getResourceId(R.styleable.UserViewView_text, 0);
String string = getResources().getString(resourceId); Log.e("UserViewView", "UserViewView init()"+string);
//回收
ta.recycle();
}
    <declare-styleable name="UserViewView">
<attr name="text" format="reference"/> </declare-styleable>
 TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.registItemView);
String item_left = typedArray.getString(R.styleable.registItemView_item_left);
String item_btn_right = typedArray.getString(R.styleable.registItemView_item_btn_right);
String item_center = typedArray.getString(R.styleable.registItemView_item_center);
boolean item_btn_right_is_gone =
typedArray.getBoolean(R.styleable.registItemView_item_btn_right_is_gone, false);
boolean item_ib_right_is_gone =
typedArray.getBoolean(R.styleable.registItemView_item_ib_right_is_gone, false); //获取引用类型的值
int itemBottomResourceId = typedArray.getResourceId(R.styleable.registItemView_item_bottom, 0);
String item_bottom = context.getString(itemBottomResourceId);
int item_input_type =
typedArray.getInt(R.styleable.registItemView_item_input_type, InputType.TYPE_CLASS_TEXT); //释放
typedArray.recycle();

最新文章

  1. 部署React+webpack工程的步骤
  2. Quartz.NET作业调度框架详解(转)
  3. 【5.1送礼】国内第一部Matlab和C#.Net混合编程视频教程【免费】
  4. 黄聪:阿里云Windows2012服务器IIS8实现wordpress完美伪静态(ISAPIRewritev)
  5. Wireshark 基本介绍和学习 TCP 三次握手
  6. POJ3177 Redundant Paths 双连通分量
  7. 极光开发者服务推出统计产品JAnalytics
  8. Jquery一些实用函数
  9. 【网站管理1】_dede织梦后台如何发布文章
  10. 利用Swagger2自动生成对外接口的文档
  11. 关于mysql分组查询
  12. 如何查看thinkphp版本号?
  13. EOS 帐户权限操作--你找不到的干货 (原创) 续集-EOS 3.0
  14. 查看linux 内存
  15. perl6: hash小笔记
  16. volatile关键字的介绍和使用
  17. SupperSocket深入浅出
  18. Transformation 线段树好题 好题 (独立写出来对线段树不容易)
  19. uboot makefile构建分析
  20. 李洪强和你一起学习前端之(4)HTML5介绍

热门文章

  1. Qt多线程学习-用例子来理解多线程
  2. 获取其他进程中“Internet Explorer_TridentCmboBx”的内容
  3. Qt学习虚拟机--基于MSYS2-MinGW环境并带有各种开源的软件库!
  4. 解除.NET中虚拟路径的疑惑
  5. 移动端数据爬取和Scrapy框架
  6. Protobuf 小试牛刀
  7. python bmp image injection
  8. kali 开启键盘背光灯 &amp;&amp; 自定义开启终端
  9. .Net之使用Jquery Ajax通过FormData对象异步提交图片文件到服务端保存并返回保存的图片路径
  10. 【HDU - 1495】非常可乐