开发者

Custom adapter to use with array of custom classes. (to populate a gridview)

I've been fiddling with a Gridview lately for a few items that I'm trying to accomplish. The others have been relatively simple and easily done. The one I'm getting stuck a开发者_如何转开发t is I am trying to populate a gridview with multiple power control widgets (ImageButtons) (named.. wifiWidget, gpsWidget & syncWidget etc..). Would this be done with an array of these custom classes? If so how would i populate an adapter with them to use with the gridview. I created this layout simply as a demonstration - http://dl.dropbox.com/u/11748819/widgets.png .

Any help would be greatly appreciated. If this is even possible.


You will need to extend BaseAdapter just like you would for a custom ListView.

Take a look at this example: http://developer.android.com/guide/tutorials/views/hello-gridview.html

Note that you could use a layout inflater to inflate your custom view from xml instead of building it programmatically. I typically use the inflater approach.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜