Answer the question
In order to leave comments, you need to log in
How to hide an element inside a gridview?
I'm trying to remove a view in a gridview and hide it. It can only be made invisible. but instead of it there is an empty space. how to force other elements to move into its place?
here's what I'm trying:
public boolean onContextItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == ACTION_DELETE) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
int index = info.position;
View view = info.targetView;
view.setVisibility(View.GONE);
}
public boolean onContextItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == ACTION_DELETE) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
int index = info.position;
View view = info.targetView;
GridView gv = (GridView)view.getParent();
gv.removeView(view);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question