I need to create interface that will look like “order”. So, there will be header data and then there will be details. I see it as all scrollable screen. But I’m not sure what the best way to bind details.
I can see how I can:
-
Create ListView and put header in first row – IMO UGLY code.
-
Create ListActivity, put header on top and ListView below – no good either since header won’t scroll.
-
I’m not sure HOW to do it but idea is to create main layout and put empty LinearLayout where details should be. Then create another Layout for details (just like I do for ListView). But I would load details and inflate those childs manually and then inject them into my LinearLayout.
Will that work? How else would you do something like that?
Thanks!
The simplest solution would be to add both a
TextViewand aListViewinside aRelativeLayout. You can actually replace theTextivewwith anyView(including aViewGorup) you need.See how to implement it in this tutorial: http://developer.android.com/resources/tutorials/views/hello-relativelayout.html
and check also Romain Guy’s posts for a nice comparison between
LinearLayoutandRelativeLayout(and good advise in general):http://android-developers.blogspot.com/2009/02/android-layout-tricks-1.html
http://android-developers.blogspot.com/2009/02/android-layout-tricks-2-reusing-layouts.html
http://android-developers.blogspot.com/2009/03/android-layout-tricks-3-optimize-with.html
Update
This is a (very simplified) way to create an expandable
LinearLayout. Of course, instead of buttons, you will add some more interesting content…MyCustomControl.java.
Test.java.