android popupwindow 中listview 无法点击问题


	final PopupWindow pop = new PopupWindow(LayoutParams.WRAP_CONTENT,LayoutParams.MATCH_PARENT);
		ListView listView = new ListView(this);
		listView.setBackgroundColor(Color.WHITE);
		ArrayAdapter adapter = new ArrayAdapter(this,
				android.R.layout.simple_list_item_1, type1);
		listView.setAdapter(adapter);
		pop.setContentView(listView);
		pop.setOutsideTouchable(true);
		pop.setFocusable(true);
//		listview.requestFocus();
		pop.update();
		pop.setBackgroundDrawable(new BitmapDrawable());
		pop.showAsDropDown(view);
		listView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView arg0, View arg1, int arg2,
					long arg3) {
				pop.dismiss();
				
			}
		});
其中包括了点击其他部分dismiss,点击listview 的item 才能取消,点击textview

你可能感兴趣的:(android,常用功能总结)