有xmlA,xmlB;MainActivity。Main中有xmlA的点击方法,要在用户点击xmlA时改变xmlB的内容,应该如何获取xmlB?
LayoutInflater layoutInflater = LayoutInflater.from(this);
View layout = layoutInflater.inflate(R.layout.layout, null);
通过这种方式加载view和setContentView不同。setContentView是直接加载到ui界面上,layoutInflater.inflate只获取你想要的view。
推荐你试一下DataBinding
你可以通过FindViewById,内容区域的 Id 是 R.id.content