我需要帮助。展开或折叠网格视图。
让我用语言解释,
gidview中有6行。这将在展开时显示。崩溃时Gridview将缩小到一行。
希望这有助于理解我的要求。
答案 0 :(得分:0)
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
}
});