我有这个代码显示listview
dialogbox
listview
框架中显示的listview
但没有任何文字(我的背景为 public void shw(View view)
{
Dialog dialog=new Dialog(MainActivity.this);
dialog.setTitle("Dialog Title");
dialog.setContentView(R.layout.custadd);
LayoutInflater inflater = getLayoutInflater();
View convertView = (View) inflater.inflate(R.layout.custadd,null);
ListView lv=(ListView) convertView.findViewById(R.id.listv);
String s1[]={"sunday","monday","tuesday"};
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(
this,
R.layout.simple_list_item, s1 );
lv.setAdapter(arrayAdapter);
dialog.show();
}
}
$form.showDialog()
答案 0 :(得分:1)
试试这个
ylimits <- c(0, max(c(count_M1, count_M2)))
p_M1 + ylim(ylimits)
p_M2 + ylim(ylimits)
答案 1 :(得分:0)
是的,因为您显示的视图ListView
不是您为Dialog
设置的视图。你应该修复如下:
Dialog dialog=new Dialog(MainActivity.this);
dialog.setTitle("Dialog Title");
LayoutInflater inflater = getLayoutInflater();
View convertView = (View) inflater.inflate(R.layout.custadd,null );
dialog.setContentView(convertView); // set convertView as content view.
// you can find listview and then fill data here
答案 2 :(得分:-1)
移除dialog.setContentView(R.layout.custadd);
,并在对话框dialog.setContentView(convertView);
时设置对话框,问题将得到解决。