android自定义layout无法预览,自定义View中再使用一个自定义view怎么无法正常显示求大神指点...
该楼层疑似违规已被系统折叠隐藏此楼查看此楼public class MainActivity extends Activity {private MyLinearLayout layoutOne;private MyLinearLayout layoutTwo;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.o.
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
public class MainActivity extends Activity {
private MyLinearLayout layoutOne;
private MyLinearLayout layoutTwo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
layoutOne = (MyLinearLayout) super.findViewById(R.id.myView1);
LayoutInflater flater = LayoutInflater.from(this);
final LinearLayout layout_1 = (LinearLayout) flater.inflate(R.layout.view1, null);
layoutOne.setAdater(new MyAdapterOne() {
@Override
public View addView() {
return layout_1;
}
});
//这个view无法显示,是什么原因?
layoutTwo = (MyLinearLayout) layout_1.findViewById(R.id.myView2);
final LinearLayout layout_2 = (LinearLayout) flater.inflate(R.layout.view2, null);
layoutTwo.setAdater(new MyAdapterOne() {
@Override
public View addView() {
return layout_2;
}
});
}
}
更多推荐
所有评论(0)