Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem laying out two ListViews
    primarykey
    data
    text
    <p>I've been struggling to lay out two ListViews in a vertical LinearLayout. I finally saw the answer on here about wrapping each in their own LinearLayout, and adding each one of these LinearLayouts to the original LinearLayout with weights of 1. So that's what I tried... but I just cannot seem to get this to work.</p> <p>I'm doing this all in code:</p> <pre><code>public class MyDualList extends LinearLayout { private LinearLayout _layout1; private LinearLayout _layout2; private ListView _list1; private ListView _list2; public MyDualList(Context context, ListView list1, ListView list2) { super(context); _list1 = list1; _list2 = list2; _layout1 = new LinearLayout(context); _layout1.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 0, 1)); _layout1.addView(_list1, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); _layout2 = new LinearLayout(context); _layout2.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 0, 1)); _layout2.addView(_list2, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); addView(_layout1); addView(_layout2); } } </code></pre> <p>This is my latest attempt, but I swear I've tried every combination/setting for the LayoutParams' height (FILL_PARENT, WRAP_CONTENT, 0) as well as various weights.</p> <p>The result is never very good; if my second list is very long, it inevitably takes up the vast majority of the original vertical layout (certainly much more than 50%).</p> <p>I'm not going to give up! Maybe someone can help me out a bit.</p> <p>Thanks, Ken</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload