全国服务热线183-8803-9437 技术热线152-8748-5914 在线咨询 留言/需求提交

Android开发控件有时不能充满整个屏幕?

【摘要】1 2 3 4 5 6 LinearLayout panel = new LinearLayout( this ); LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT); panel.setLayoutParams(llp); root.addVie
1
2
3
4
5
6
LinearLayout panel = new LinearLayout(this);
LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(
        LinearLayout.LayoutParams.FILL_PARENT,
        LinearLayout.LayoutParams.FILL_PARENT);
panel.setLayoutParams(llp);
root.addView(panel);

而应该是:

1
2
3
4
5
LinearLayout panel = new LinearLayout(this);
LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(
        LinearLayout.LayoutParams.FILL_PARENT,
        LinearLayout.LayoutParams.FILL_PARENT);
root.addView(panel. llp);