I've tried this code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<ListView
android:id="@+id/List1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
开发者_开发百科 <ListView
android:id="@+id/List2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
<ListView
android:id="@+id/List3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
<ListView
android:id="@+id/List4"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
With no success. This works, but I don't want to divide the x
screen for all lists, I want to extend the width
of every list and make it possible to scroll on x
axis ...
Does anyone know if I can do this ?
It's possible. In your case it does not work because the android:layout_width
is set to fill_parent
, thus the first layout will take all the available space. Try giving android:layout_weight="1"
to each ListView
. And remove the inner LinearLayouts
which are no necessary.
This worked for me:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<ListView
android:id="@+id/List1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
<ListView
android:id="@+id/List2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
</LinearLayout>
I just took your code and remove two of the lists views:
精彩评论