(Edited: I’m one step further than before)
I’ve been trying to get a simple 2-column TableLayout going where I have a LinearLayout in my left column that I dynamically add elements to which fills up the horizontal space except for the fixed 100px right column.
Here’s what I have so far which works for me IF the LinearLayout contains more than one element. If it contains only one element, the right column is pushed out to the right of the screen
<ScrollView android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@layout/main">
<TableLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.4"
android:orientation="vertical"></LinearLayout>
<com.epaga.ArcDrawableView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="right" android:layout_weight="0.1" >
</com.epaga.ArcDrawableView>
</TableRow>
</TableLayout>
</ScrollView>
Things I’ve tried:
- changing the drawable view (which is supposed to be the fixed column) to
android:layout_width="150px" - changing the
stretchcolumnssetting to 0. - changing the left columns’
layout_widthto either fill_parent (pushes the right column off the screen) or wrap_content (collapses the left column)
Any thoughts?
First, why are you using a
TableLayout? Why not just use nestedLinearLayouts? You’ve already decided you don’t care about the primary use for aTableLayout— automatic computation of column sizes — because you’re trying to fix the column sizes yourself.Second, can you get it working using an ordinary widget for the right column, rather than your custom
Viewclass? Your problem may be due to your customView— I’d start by getting something working the way you want using ordinary widgets.