Gridview折叠扩展android
我需要帮助。展开或折叠栅格视图 让我用语言解释一下 gidview中有6行。这将显示在展开上。Gridview将在折叠时收缩到一行Gridview折叠扩展android,android,animation,gridview,expand,Android,Animation,Gridview,Expand,我需要帮助。展开或折叠栅格视图 让我用语言解释一下 gidview中有6行。这将显示在展开上。Gridview将在折叠时收缩到一行 希望这有助于理解我的要求。您没有附上picture@SyedNazarMuhammad,很抱歉,我无法附加图像。请用文字检查要求。gridview行数是否固定为6?他们不会改变吗?是的,固定为6。我们不能动态更改吗?如果每件事情都是固定的,那么您可以在xml布局中执行此操作,使自定义的六行GridView像视图一样,并使其中的5行变为可见,然后在展开时使所有行变为可
希望这有助于理解我的要求。您没有附上picture@SyedNazarMuhammad,很抱歉,我无法附加图像。请用文字检查要求。gridview行数是否固定为6?他们不会改变吗?是的,固定为6。我们不能动态更改吗?如果每件事情都是固定的,那么您可以在xml布局中执行此操作,使自定义的六行GridView像视图一样,并使其中的5行变为可见,然后在展开时使所有行变为可见
expandButton.setonClickListener(new View.onClickListener(){
@Override
public void onClick(View v)
{
gridlist.addAll(templist); // adding all rows which are stored in temp list
gridviewadapter.notifyDataSetChanged(); // will reflect and refreshes the ui to show 6 rows
}
});
collapseButton.setonClickListener(new View.onClickListener(){
@Override
public void onClick(View v)
{
gridlist.removeAll();// removing all rows
gridlist.Add(templist.get(0));
gridlist.Add(templist.get(1)); //adding only two items to list
gridviewadapter.notifyDataSetChanged(); // will reflect and refreshes the ui to show 1st row
}
});