获取其他布局文件中的控件方法

如何获取其他布局文件中的控件呢?很简单,android已经有封装好的方法了:

LayoutInflater factorys = LayoutInflater.from(WelcomeActivity.this);
final View buttonEntryView = factorys.inflate(R.layout.welcome_item03, null);
Button button = (Button) buttonEntryView.findViewById(R.id.btn_welcome);

 

 先找到是哪一个布局文件,然后通过布局文件来找控件就OK了!

猜你喜欢

转载自411373793.iteye.com/blog/2192912