一般都这么写setContentView(R.layout.teamsns_feed_detail);
但是有时候需要rootView ,可以改为如下
LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rootView = layoutInflater.inflate(R.layout.teamsns_feed_detail, null);setContentView(rootView);
本文详细介绍了在Android开发中如何使用LayoutInflater来替代传统的setContentView方法,以实现更灵活的布局加载方式。通过引入LayoutInflater,开发者能够更轻松地在运行时动态加载XML布局文件,提供了一种更加灵活和强大的布局管理手段。
2124

被折叠的 条评论
为什么被折叠?



