We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ps:请从源码角度分析相关方法。
The text was updated successfully, but these errors were encountered:
系统通过LayoutInflater.from创建出布局构造器,inflate方法中,最后会掉用createViewFromTag 这里他会去判断 两个参数 factory2 和factory 如果都会空就会系统自己去创建view, 并且通过一个xml解析器,获取标签名字,然后判断是<Button还是xxx.xxx.xxView. 然后走createView 通过拼接得到全类名路径,反射创建出类。
Sorry, something went wrong.
layoutInflater.inflate 会根据root标签判断是否是merge 是merge则解析merge标签,否则createViewFromTag创建view,优先factory2 没有就factory 来createview 优先 new 如果为空则拼接字符串来反射创建view
通过XML pull解析方式获取view标签 通过反射创建view标签的view对象
https://xujiaojie.github.io/2017/09/04/%E6%B7%B1%E5%85%A5%E7%90%86%E8%A7%A3LayoutInflater.inflate()/
No branches or pull requests
The text was updated successfully, but these errors were encountered: