Android(安卓)LayoutInflater用法
16lz
2022-04-04
LayoutInflater inflater = LayoutInflater.from(this);View v = inflater.inflate(R.layout.dialog1, null);TextView tv = (TextView)v.findViewById(R.id.textView1);
使用该用法会导致提示:
Avoid passing null as the view root (needed to resolve layout parameters on the inflated layout's root element)
LayoutInflater inflater = LayoutInflater.from(this);View v = inflater.inflate(R.layout.dialog1, new LinearLayout(this),false);TextView tv = (TextView)v.findViewById(R.id.textView1);
就不会出现问题了
更多相关文章
- android 进度对话框的使用
- Android提示框
- Android获取不到ID
- Android支持单词提示搜索框的网络请求策略
- unity 关闭弹出android 提示框
- Android输入框中提示自动输入内容
- android p 充拔电提示音
- 系出名门Android(3) - 对话框(Dialog)和通知(Notification)
- Android(安卓)启动模拟器是出现“Failed to allocate memory: 8