谁知道为什么mLinearLayout2部分显示不出来?谢谢.
public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);
this.setTitle("却换图层");
mTextView1 = new TextView(this);
mTextView1.setText("图层名");
mMap = new HashMap<String, String>();
mMap.put("K1fdwe", "K1fdwe");
mMap.put("K2fdme", "K1fdwe");
mMap.put("K3fmfd", "K1fdwe");
mMap.put("K4fd", "K1fdwe");
for (Map.Entry<String, String> entry : mMap.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
mKeyList.add(key);
mValueList.add(value);
}
mListView1 = new ListView(this);
mListView1.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
mListView1.setOnItemClickListener(mOnItemClickListener);
ArrayAdapter<String> mAdapter1 = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_multiple_choice, mKeyList);//mKeyList有值
mListView1.setAdapter(mAdapter1);
mLinearLayout1 = new LinearLayout(this);
mLinearLayout1.setOrientation(LinearLayout.VERTICAL);
mLinearLayout1.addView(mTextView1, new LayoutParams(WC, WC));
mLinearLayout1.addView(mListView1, new LayoutParams(WC, WC));
mTextView2 = new TextView(this);
mTextView2.setText("图层描述");
mListView2 = new ListView(this);
ArrayAdapter<String> mAdapter2 = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, mValueList);//mValueList有值
mListView2.setAdapter(mAdapter2);
mLinearLayout2 = new LinearLayout(this);
mLinearLayout2.setOrientation(LinearLayout.VERTICAL);
mLinearLayout2.addView(mTextView2, new LayoutParams(WC, WC));
mLinearLayout2.addView(mListView2, new LayoutParams(WC, WC));
mLinearLayout3 = new LinearLayout(this);
mLinearLayout3.setOrientation(LinearLayout.HORIZONTAL);
mLinearLayout3.addView(mLinearLayout1, new LayoutParams(WC, FP));
mLinearLayout3.addView(mLinearLayout2, new LayoutParams(WC, FP));
this.setContentView(mLinearLayout3);
} --------------------编程问答-------------------- 建议用sdk中tools目录下的hierarchyviewer.bat工具查看下布局,个人感觉是mLinearLayout2被挤出到可视区域以外了。
补充:移动开发 , Android