自定义实现个Factory,可以用来解析自定义的属性。
public interface Factory {
/**
* Hook you can supply that is called when inflating from a LayoutInflater.
* You can use this to customize the tag names available in your XML
* layout files.
*
* <p>
* Note that it is good practice to prefix these custom names with your
* package (i.e., com.coolcompany.apps) to avoid conflicts with system
* names.
*
* @param name Tag name to be inflated.
* @param context The context the view is being created in.
* @param attrs Inflation attributes as specified in XML file.
*
* @return View Newly created view. Return null for the default
* behavior.如果返回一个view, 那么就会直接加入到原有View树中去。 如果返回null,则会走原来类似于onCreate的方法。
*/
public View onCreateView(String name, Context context, AttributeSet attrs);
}

LayoutInflater.Factory这个值设置到LayoutInflater中,而LayoutInflater的获得又是跟谁Context而来的。也就是说相同的Context有着相同的LayoutInflater,那就可以重用相同的LayoutInflater.factory

在BaseActivity中加入自己的Factory

     mLayoutMode = new BDLayoutMode(); // 针对该Activity的一些存储
mLayoutInflateFactory = new BDLayoutInflateFactory(); //自定义的LayoutInflateFactory
mLayoutInflateFactory.setViewMode(mLayoutMode);
getLayoutInflater().setFactory(mLayoutInflateFactory); // 给该Activitry设置factory

这样在BDLayoutInflateFactory中就可以自定义解析自己关心的值了。

在BaseActivity的OnResume中开始,遍历每一个控件。

最新文章

  1. weex image
  2. switch
  3. 【PHP入门到精通】:Ch05:字符串处理
  4. 【每天一个Linux命令】14. Linux中locate命令的用法
  5. APK瘦身
  6. Java 八大类型、String和 StringBuffer
  7. 第2章 rsync算法原理和工作流程分析
  8. js error
  9. 自己写一个网页版的Markdown实时编辑器
  10. 《Oracle Applications DBA 基础》- 9 - Concurrent Processing
  11. css,解决文字与图片对齐的问题
  12. Neutron server的运行原理(未完待续)
  13. springMVC的配置与使用
  14. bzoj5358
  15. Java 初级软件工程师 认证考试试卷1
  16. Centos 7 下创建LVM流程
  17. 使用OpenSSL自建CA + Nginx配置HTTPS
  18. 【AtCoder Grand Contest 001F】Wide Swap [线段树][拓扑]
  19. jquery delayLoading.js插件的延迟加载效果和图片延迟加载
  20. 解决java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver问题

热门文章

  1. 如何在Dynamics CRM 2011 的窗体表单上加载报表
  2. DBA常用SQL之表空间与数据文件
  3. javascript 容错
  4. [JAVA] java程序性能优化
  5. 导出resource文件的的资源
  6. of
  7. OpenCV图像处理篇之边缘检测算子
  8. IntelliJ IDEA常用快捷键
  9. 理解和配置 Linux 下的 OOM Killer
  10. BeX5学习笔记