简体   繁体   中英

Android; Dynamic buttons layout

I have a list filled with values and a list with questions, some elements in the value list have more than 1 element, so for example

question[2] = Light
question[3] = Toppings

value[2] = on / off
value[3] = cheese / peppers / oranges / apples
(i split these values on " / ")

now i want use buttons in place for values, for every single question and value in the lists.

is this possible and if yes what is the best approach to create such a layout?

full example: 在此处输入图像描述

If you list is static and small you way consider creating same using the simple layout, using textview for the questions and buttons for the values.

Or

You can use the recyclerview with GridLayoutManager ans set the column count dynamically as shown here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM