2

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <TextView
        android:id="@+id/section_one_header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="18dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="10dp"
        android:singleLine="true"
        android:text="Summary"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#51556C"
        android:textSize="13sp"
        android:textStyle="bold" />

    <ListView
        android:id="@+id/section_list_view"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="5dp" >
    </ListView>

    <TextView
        android:id="@+id/section_two_header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="18dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="10dp"
        android:singleLine="true"
        android:text="Data"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#51556C"
        android:textSize="13sp"
        android:textStyle="bold" >
    </TextView>

    <LinearLayout
        android:id="@+id/eve_det"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="5dp"
        android:background="@layout/style_evedetail"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/section_two_data"
            android:layout_width="fill_parent"
            android:layout_height="100dp"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp"
            android:scrollbars="vertical"
            android:textSize="10sp" >
        </TextView>

        <EditText
            android:id="@+id/section_two_edit_text"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp"
            android:focusableInTouchMode="true"
            android:imeActionId="@+id/done_button"
            android:imeActionLabel="done"
            android:singleLine="true" />
    </LinearLayout>

    <TextView
        android:id="@+id/section_three_header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="18dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="10dp"
        android:text="Attachment"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#51556C"
        android:textSize="13sp"
        android:textStyle="bold" >
    </TextView>
    <ListView
        android:id="@+id/attachment_list_view"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp" />
</LinearLayout>

this is the code under scroll view. Here i need to display Header and corresponding ListView then TextView with Edit Text, then again header and ListView. Can any one help me how to show all the list items in Two list views or if any one has other idea help me.

Rob
  • 4,927
  • 12
  • 49
  • 54
  • check out following post for info http://stackoverflow.com/questions/6210895/listview-inside-scrollview-is-not-scrolling-on-android – Praful Bhatnagar Mar 26 '13 at 11:35

1 Answers1

2

Yes as the List view has default scroll able functionality . If you place a list-view inside the another scroll-able view (say a Scroll-view ). The list scroll will hamper.

To Avoid such thing , list view has the concepts of header and footer views.

You can add n number of header and footers to the list.

Below is a sample code snippet how to add header/footer by inflating any xml layout to it

LayoutInflater inflater = activity.getLayoutInflater();
LinearLayout listFooterView = (LinearLayout)inflater.inflate(
            R.layout.footer_layout, null);

list.addFooterView(listFooterView);


LinearLayout listHeaderView = (LinearLayout)inflater.inflate(
                R.layout.header_layout, null);

    list.addHeaderView(listHeaderView);
Arpit Garg
  • 8,476
  • 6
  • 34
  • 59
  • Thanks for your suggestion it is so helpful. Iam able to view header Textview but am not able to view all list items of "section_list_view", "attachment_list_view", They are showing only one item. – Srinivas Rampelli Mar 26 '13 at 11:44
  • You need to remove the scroll view completely, just use list-view along with footers and headers , and make sure to give some height to the two separate listviews – Arpit Garg Mar 26 '13 at 11:48