Array of ImageButtons, assign R.view.id from a variable

前端 未结 3 2049
余生分开走
余生分开走 2021-02-14 23:05

Hey there. My app is going to be using an array of 64 ImageButtons (8x8), and they\'re all already declared in my XML Layout with names like one1, two5, eight8, etc. Rather than

3条回答
  •  没有蜡笔的小新
    2021-02-14 23:54

    Unless there's some specific need to do it as individual ImageButtons, you might be better off using a GridView.

    Here is a tutorial using images in a GridView using an adapter.

提交回复
热议问题