title: how to make listview to take its appropriate lenght without scroll
body: <p>i am creating a <strong>custom dropdown</strong>,where custom dropdown is created <strong>using relative layout and listview</strong>, on click of  relative layout i am making <strong>listview to visible and gone</strong>, so like this there are many dropdowns vertically one after the other. Without putting scrollview it works fine, Here the problem is if i apply <strong>scrollview</strong> to whole layout <strong>dropdown(which is made using listview)</strong> will take only some space and inside the listview itself it enables scroll inside that some space. But i want it to appear as it is without scrolling listview. How could i do this.Any help and suggestion are welcomed.</p>
  
  <p><strong>without scroll view</strong></p>
  
  <p><a href="https://i.stack.imgur.com/RBVwn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RBVwn.png" alt="enter image description here"></a></p>
  
  <p><strong>with scroll view</strong></p>
  
  <p><a href="https://i.stack.imgur.com/JWKJz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JWKJz.png" alt="enter image description here"></a></p>
  
  <p><strong>here i want it to appaer as in without scrollview image ,even if i apply scroll view to whole layout(here whole layout contains number of dropdowns as in figure.)</strong></p>
  
  <pre><code> &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fillViewport="true"&gt;
  &lt;RelativeLayout
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:padding="8dp"
              android:id="@+id/layoutView"
  
              android:background="@drawable/customborder"&gt;
              &lt;LinearLayout
                  android:layout_centerVertical="true"
                  android:id="@+id/Text"
                  android:orientation="vertical"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:paddingLeft="10dip"&gt;
                  &lt;TextView
                      android:id="@+id/viewtext"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="-Select-"
                      android:textColor="#ff3333"
                      android:textSize="10dip" /&gt;
              &lt;/LinearLayout&gt;
              &lt;ImageView
                  android:id="@+id/imageView4"
                  android:layout_width="20dp"
                  android:layout_height="20dp"
                  android:padding="0dp"
                  android:src="@drawable/DropDownArrowIcon"
                  android:layout_alignParentRight="true" /&gt;
          &lt;/RelativeLayout&gt;
          &lt;LinearLayout
              android:id="@+id/listViewborder"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:background="#2AACFF"
              android:gravity="center_horizontal"
              android:orientation="vertical"
              android:padding="0.5dp"&gt;
              &lt;ListView
                  android:layout_margin="1dp"
                  android:id="@+id/listView"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  android:cacheColorHint="#57585B"
                  android:divider="@drawable/list_divider"
                  android:dividerHeight="1dp" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;TextView
              android:text="Type of bussinness"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:id="@+id/bankInvesttxt"
              android:textSize="15dp"
              android:layout_marginTop="5dp"
              android:layout_marginBottom="5dp" /&gt;
          &lt;RelativeLayout
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:padding="8dp"
              android:id="@+id/layoutView"
              android:background="@drawable/customborder"&gt;
              &lt;LinearLayout
                  android:layout_centerVertical="true"
                  android:id="@+id/bankInvestTextlayout"
                  android:orientation="vertical"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:paddingLeft="10dip"&gt;
                  &lt;TextView
                      android:id="@+id/bankInvestviewtext"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="-Select-"
                      android:textColor="#FFFFFF"
                      android:textSize="10dip" /&gt;
              &lt;/LinearLayout&gt;
              &lt;ImageView
                  android:id="@+id/bankInvestimageView"
                  android:layout_width="20dp"
                  android:layout_height="20dp"
                  android:padding="0dp"
                  android:src="@drawable/DropDownArrowIcon"
                  android:layout_alignParentRight="true" /&gt;
          &lt;/RelativeLayout&gt;
          &lt;LinearLayout
              android:id="@+id/bankInvestlistViewborder"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:background="#2AACFF"
              android:gravity="center_horizontal"
              android:orientation="vertical"
              android:padding="0.5dp"&gt;
              &lt;ListView
                  android:layout_margin="1dp"
                  android:id="@+id/bankInvestlistView"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  android:cacheColorHint="#57585B"
                  android:divider="@drawable/list_divider"
                  android:dividerHeight="1dp" /&gt;
          &lt;/LinearLayout&gt;
  &lt;/ScrollView&gt;
  </code></pre>