I want to create a custom list item. Basically it should 3 areas in a horizontal LinearLayout
. The most left one is supposed to be 50dp wide, the right most one as well. I would like the one in the middle to take up the rest of the space. In the end it should be 50px | width - 100px | 50px.
Can I do this in XML?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:gravity="right" >
<FrameLayout
android:id="@+id/frameLayout1"
android:layout_width="50dp"
android:layout_
android:layout_height="match_parent"
android:layout_weight="0">
</FrameLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="fill"
android:orientation="vertical"
android:layout_weight="0">
</LinearLayout>
<FrameLayout
android:id="@+id/frameLayout2"
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_weight="0" >
</FrameLayout>
</LinearLayout>
Just set the layout-weight
of the middle item to 1. And layout_width
to fill_parent
.