在我的android应用程序中,.i有网格视图。在对网格视图选择项之一执行操作后,我想设置项false.how的可见性以执行此操作?
代码如下-
public void onItemClick(AdapterView<?> arg0, View arg1, int no,long lg) {
// TODO Auto-generated method stub
AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this);
id=no;
alert.setTitle("Title");
alert.setMessage("Message");
alert.setIcon(flag[no]);
// Set an EditText view to get user input
final EditText input = new EditText(MainActivity.this);
alert.setView(input);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String value = input.getText().toString();
// Do something with value!
System.out.println("mmmm"+value);
if(value.equalsIgnoreCase(country[id])){
// here i want to set item visibility..
}
else
{}
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Canceled.
}
});
alert.show();
}
});发布于 2012-12-04 12:27:28
您不能在gridView中隐藏单个项目
您唯一能做的就是更改传递到gridView适配器的项目列表。您可以从列表中删除要隐藏的项,并调用notifyDataSetChanged以使gridView反映您的更改。
https://stackoverflow.com/questions/13685791
复制相似问题