开发者

android adding buttons to gridview

I'm new to android programming. I'm trying to make 2x2 matriks using gridview and each spot has a button..

my questions are :

  1. how to add the buttons ?

  2. H开发者_StackOverflow中文版ow to declare the UI layout ?

  3. how to set the click listener to each button ?

THX for the help


Basically you need to associated an Adapter with your GridView that will keep track of the data/contents of the view. And from the getView() of your Adapter you return the type of View that you want (Button in this case) and handle button selection etc.

Check out the Hello-GridView example for a better undersatnding

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜