title: Two ListViews inside a Linear Layout
body: <p>PLease help me with layout of the two list views placed vertically in the Linear Layout. Problem is that if list1 had more data than list2 is not visible and it not scrollable, using scollview is not solution.</p>
  
  <pre><code>     &lt;?xml version="1.0" encoding="utf-8"?&gt;
       &lt;LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:background="@drawable/backrepeat"
      android:orientation="vertical" &gt;
  
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:background="@drawable/shape_calendar_top"
          android:orientation="horizontal" &gt;
  
          &lt;ImageView
              android:id="@+id/prevMonth"
              android:layout_width="50dp"
              android:layout_height="55dp"
              android:src="@drawable/button_events_previous" &gt;
          &lt;/ImageView&gt;
  
          &lt;TextView
              android:id="@+id/currentMonth"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center_vertical"
              android:layout_weight="0.6"
              android:gravity="center_vertical|center_horizontal"
              android:text="Janauary"
              android:textAppearance="?android:attr/textAppearanceMedium"
              android:textColor="#d458b1"
              android:textStyle="bold" &gt;
          &lt;/TextView&gt;
  
          &lt;ImageView
              android:id="@+id/nextMonth"
              android:layout_width="50dp"
              android:layout_height="55dp"
              android:src="@drawable/button_events_next" /&gt;
      &lt;/LinearLayout&gt;
  
  
          &lt;TextView
              android:id="@+id/direction_label"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_alignParentLeft="true"
              android:layout_alignParentRight="true"
              android:layout_marginTop="10dp"
              android:background="#DA81F5"
              android:paddingLeft="5dp"
              android:paddingTop="5dp"
              android:text="PRESS RELEASES"
              android:textColor="#FFFFFF"
              android:textSize="13dip" /&gt;
  
          &lt;ListView
              android:id="@+id/eventsList"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_below="@+id/direction_label"
              android:background="#ffffff" &gt;
          &lt;/ListView&gt;
  
  
          &lt;TextView
              android:id="@+id/direction_label1"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginTop="10dp"
              android:background="#DA81F5"
              android:paddingLeft="5dp"
              android:paddingTop="5dp"
              android:text="SPEECHES"
              android:textColor="#FFFFFF"
              android:textSize="13dip" /&gt;
  
          &lt;ListView
              android:id="@+id/eventsList1"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_below="@+id/direction_label1"
              android:background="#ffffff" &gt;
          &lt;/ListView&gt;
  
  
      &lt;TextView
          android:id="@+id/empty_list"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:gravity="center"
          android:text=""
          android:textAppearance="?android:attr/textAppearanceMedium" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>If I use the scrollview then it is wrapping up the listview for only first row.</p>
  
  <p>Please suggest something.</p>
  
  <p>EDIT :</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;LinearLayout 
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:background="@drawable/backrepeat"
      android:orientation="vertical" &gt;
  
  
  
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:background="@drawable/shape_calendar_top"
          android:orientation="horizontal" &gt;
  
          &lt;ImageView
              android:id="@+id/prevMonth"
              android:layout_width="50dp"
              android:layout_height="55dp"
              android:src="@drawable/button_events_previous" &gt;
          &lt;/ImageView&gt;
  
          &lt;TextView
              android:id="@+id/currentMonth"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center_vertical"
              android:layout_weight="0.6"
              android:gravity="center_vertical|center_horizontal"
              android:text="Janauary"
              android:textAppearance="?android:attr/textAppearanceMedium"
              android:textColor="#d458b1"
              android:textStyle="bold" &gt;
          &lt;/TextView&gt;
  
          &lt;ImageView
              android:id="@+id/nextMonth"
              android:layout_width="50dp"
              android:layout_height="55dp"
              android:src="@drawable/button_events_next" /&gt;
      &lt;/LinearLayout&gt;
  
  
          &lt;TextView
              android:id="@+id/direction_label"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_alignParentLeft="true"
              android:layout_alignParentRight="true"
              android:layout_marginTop="10dp"
              android:background="#DA81F5"
              android:paddingLeft="5dp"
              android:paddingTop="5dp"
              android:text="PRESS RELEASES"
              android:textColor="#FFFFFF"
              android:textSize="13dip" /&gt;
  
          &lt;ListView
              android:id="@+id/eventsList"
              android:layout_width="fill_parent"
              android:layout_height="0dp"
              android:layout_weight="1"
              android:layout_below="@+id/direction_label"
              android:background="#ffffff" &gt;
          &lt;/ListView&gt;
  
          &lt;TextView
              android:id="@+id/direction_label1"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginTop="10dp"
              android:background="#DA81F5"
              android:paddingLeft="5dp"
              android:paddingTop="5dp"
              android:text="SPEECHES"
              android:textColor="#FFFFFF"
              android:textSize="13dip" /&gt;
  
          &lt;ListView
              android:id="@+id/eventsList1"
              android:layout_width="fill_parent"
                   android:layout_height="0dp"
              android:layout_weight="1"
              android:layout_below="@+id/direction_label1"
              android:background="#ffffff" &gt;
          &lt;/ListView&gt;
  
      &lt;TextView
          android:id="@+id/empty_list"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:gravity="center"
          android:text=""
          android:textAppearance="?android:attr/textAppearanceMedium" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>If I use this, nothing is shown :(</p>
  
  <p>Asmi</p>
  
  <p>EDIT : CODE FOR THE TWO LISTVIEWS:</p>
  
  <pre><code>            {
                  arrayofWebData.add(cn);
                  listAdapter = new SelectArralAdapter(getActivity(),
                          arrayofWebData);
                  List_events.setAdapter(listAdapter);
              }
  </code></pre>
  
  <p>For the Second ListView it is as follows :</p>
  
  <pre><code>  if ((year == event_year) &amp;&amp; (event_month == month))
  
              {
              arrayofWebDataPress.add(cn);
              listAdapter_press = new   SelectArralAdapter_Press(getActivity(),arrayofWebDataPress);
                  List_events_press.setAdapter(listAdapter_press);
                  i++;
  
              }
  </code></pre>
  
  <p>Array Adapter for the two ListViews :</p>
  
  <pre><code>     class SelectArralAdapter_Press extends ArrayAdapter&lt;PressDB&gt; {
  
      private LayoutInflater inflater;
  
      public SelectArralAdapter_Press(Context context,
              ArrayList&lt;PressDB&gt; arrayofWebDataPress) {
  
          super(context, R.layout.speech_list_item, R.id.event_title,
                  arrayofWebDataPress);
          inflater = LayoutInflater.from(context);
  
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
  
          ViewHolder_Press holder;
          if (convertView == null) {
  
              convertView = inflater.inflate(R.layout.speech_list_item, null);
  
              holder = new ViewHolder_Press(convertView);
              convertView.setTag(holder);
  
          } else {
  
              holder = (ViewHolder_Press) convertView.getTag();
          }
          holder.populateFrom(arrayofWebDataPress.get(position));
  
          return (convertView);
      }
  
  }
  
    class ViewHolder_Press{
      public TextView event_name = null;
      public TextView event_date = null;
  
      public ViewHolder_Press(View row) {
          event_name = (TextView) row.findViewById(R.id.event_title);
          event_date = (TextView) row.findViewById(R.id.event_date_time);
  
      }
  
      void populateFrom(PressDB eventsMainDB) {
          event_name.setText(eventsMainDB.press_name);
          event_date.setText(eventsMainDB.press_date + " ");
      }
  }
  </code></pre>
  
  <p>For the second Adaper :</p>
  
  <pre><code>      class SelectArralAdapter extends ArrayAdapter&lt;SpeechDB&gt; {
  
      private LayoutInflater inflater;
  
      public SelectArralAdapter(Context context,
              ArrayList&lt;SpeechDB&gt; arrayofWebData) {
  
          super(context, R.layout.speech_list_item, R.id.event_title,
                  arrayofWebData);
          inflater = LayoutInflater.from(context);
  
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
  
          ViewHolder holder;
          if (convertView == null) {
  
              convertView = inflater.inflate(R.layout.speech_list_item, null);
  
              holder = new ViewHolder(convertView);
              convertView.setTag(holder);
  
          } else {
  
              holder = (ViewHolder) convertView.getTag();
          }
          holder.populateFrom(arrayofWebData.get(position));
  
          return (convertView);
      }
  
  }
  
  class ViewHolder {
      public TextView event_name = null;
      public TextView event_date = null;
  
      public ViewHolder(View row) {
  
          event_name = (TextView) row.findViewById(R.id.event_title);
  
          event_date = (TextView) row.findViewById(R.id.event_date_time);
  
      }
  
      void populateFrom(SpeechDB eventsMainDB) {
          event_name.setText(eventsMainDB.speech_name);
  
          event_date.setText(eventsMainDB.speech_date + " ");
  
  
      }
  
  }
  </code></pre>