开发者

How to create icon view to list view and vice versa switching mechanism in android

I am looking to create an application where some items are showcased. Currently they are being shown in a list with title, subtitle, icon and some information. I am thinking of implementing a layout switcher here, which will enable to user to change this view to lets say icon view where they may be displayed as a grid of 3 columns. Also this switching can be animated if possible. There will be two buttons over the view, one r开发者_如何学Cepresenting list view and other icon. Clicking on any will show up the respective view. Any idea how to do that??


for list

gridview.setNumColumns(1);

and for grid

gridview.setNumColumns(2);


You can switch the view shown in activity using setContentView() method you can call setcontentview in onClick callback.so that whole you can switch between gridview and listview. Cheers....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜