0

How can I achieve two sections below listview where I can place dynamic radio buttons, Below is my image. The listview can be scrollable to an extent, and below that there will be layouts divided into two parts for radiobuttons to fit dynamically

Below is my layout :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:text="@string/some_text"
        android:textSize="20sp" />

    <Button
        android:id="@+id/findSelected"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Find countries that are Selected" />

    <ListView
        android:id="@+id/listView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />



</LinearLayout>
Christine
  • 329
  • 1
  • 4
  • 13

1 Answers1

1

You should use weighted propertie and horizontal LinearLayout as footer. Your code should looks like:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:text="@string/some_text"
        android:textSize="20sp" />

    <Button
        android:id="@+id/findSelected"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Find countries that are Selected" />

    <!-- Below attributes (layout_height and layout_weight) to fill as much as possible -->
    <ListView
        android:id="@+id/listView1"
        android:layout_width="match_parent"
        android:layout_height="0dp" 
        android:layout_weight="1"
        android:gravity="top"/> 


    <LinearLayout 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <LinearLayout 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content">
            <!-- Content of the column 1 -->
        </LinearLayout>
        <LinearLayout 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content">
            <!-- Content of the column 2 -->
        </LinearLayout> 
    </LinearLayout>
</LinearLayout>