1

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. How to declare the UI layout ?

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

THX for the help

1

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.