具有多行的Android Listview与UperEats类似

时间:2017-03-01 11:14:04

标签: android listview checkbox radio-button

正如您在屏幕截图中看到的,我需要实现相同的功能

这个想法是每个产品都有选项,每个选项都有多个 选项,选项可以是单选或多选。

你可以看到下面的JSON

   {"Id":1,"Name":"Special","Description":null,"HasOptions":true,"ProductItemImageModel":null,"ProductItemPriceModel":null,"Options":[{"OptionId":5,"OptionName":"Add Extra","Type":1,"OptionItems":[{"ItemOptionId":9,"ItemOptionName":"Green Pepper","ItemOptionPrice":2.5},{"ItemOptionId":10,"ItemOptionName":"Mushroom","ItemOptionPrice":2.5}]},{"OptionId":6,"OptionName":"DoughType","Type":2,"OptionItems":[{"ItemOptionId":6,"ItemOptionName":"Brown","ItemOptionPrice":2.5},{"ItemOptionId":7,"ItemOptionName":"Extra Thin","ItemOptionPrice":2.5},{"ItemOptionId":8,"ItemOptionName":"Regular","ItemOptionPrice":2.5}]}],"IsSucceeded":true,"Errors":null} 

正如您在选项中看到的那样,有类型,1然后是单选按钮选项,2然后是复选框选项。

我需要与 UperEats

相同

我该如何实现?

Image1
Image2

enter image description here enter image description here

2 个答案:

答案 0 :(得分:0)

对于这个JSON> UI转换我建议使用PreferenceActivity

https://developer.android.com/reference/android/preference/PreferenceActivity.html

RecyclerView

https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html

这取决于你想要的东西。

答案 1 :(得分:0)

最好使用RecyclerView.AdaptergetItemViewType类有ALTER TABLE demo RENAME INDEX old_index TO new_index 方法。您可以决定膨胀的布局。

请参阅this.