1

I am trying to create this layout in XML. This is a screenshot from the design I did in Photoshop.

enter image description here

I am not so sure on how to go about it though. First I decided that I wanted to use Preferences UI but then I saw that Preferences UI is better used with preferences only. So I am thinking of using a ListView but that wont work because the these rows are different. ListViews normally have identical rows. so I am thinking of using a TableLayout? What do you just that I do? I just need some advice.

Joel Dean
  • 2,444
  • 5
  • 32
  • 50
  • probably you have already read this guide but if you missed it, it may be helpful [Settings Google guide](http://developer.android.com/guide/topics/ui/settings.html) – Roberto Lombardini Sep 04 '13 at 15:42

3 Answers3

2

If you have just a few items, or even more than what fits on a screen but very diverse, don't use ListView. Use a LinearLayout on a ScrollView. ListView does heavy weight optimization with cell reusing which is not required for you. At design time put everything on the screen you need and use it as is. Go for the simplest solution and think of optimization if you encounter performance issues. For the type of screen you show this is not probable, though.

Romain Guy explains this clearly in this post: How can I put a ListView into a ScrollView without it collapsing?

Community
  • 1
  • 1
allprog
  • 16,540
  • 9
  • 56
  • 97
1

Go on with relative layout as the parent. Each row can be a linear layout having text views. For your on/off button use a toggle button with on/off image.

Ritaban
  • 763
  • 4
  • 8
1

listviews dont have to have identical rows. All you have to do is create different row layouts and in the information you send into your custom adapter indicate the layout that should be inflated by the data.

or you can have all the different views in one layout and hide/show the view you want based on the data in the adapter

the best option is to just put everything in a linearlayout in a scrollview with dividers after each section

tyczj
  • 71,600
  • 54
  • 194
  • 296