我想在没有任何布局的对话框中显示所选视图,这可能吗?
错误 java.lang.IllegalStateException:指定的子级已有父级。您必须首先在孩子的父母身上调用removeView()。
在主要活动......
MyImageAdapter myImageAdapter = new MyImageAdapter(img);
lvImages.setAdapter(myImageAdapter);
lvImages.setOnItemClickListener(new OnItemClickListener(){
public void onItemClick(AdapterView<?> parent, View view,
int arg2, long arg3) {
Dialog dialog = new Dialog(act);
dialog.setContentView(parent);
dialog.show();
在自定义适配器中......
public class MyImageAdapter extends BaseAdapter {
public String getItem(int position) {
return camNames.get(position);
}
public View getView(int position, View view, ViewGroup parent) {
...
return (ImageView) view
}