0

I have the following layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginLeft="@dimen/feed_item_margin"
        android:layout_marginRight="@dimen/feed_item_margin"
        android:layout_marginTop="@dimen/feed_item_margin"
        android:orientation="vertical"
        android:paddingBottom="@dimen/feed_item_padding_top_bottom"
        android:paddingTop="@dimen/feed_item_padding_top_bottom" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <ImageView
                android:contentDescription="@string/feed_icon_typeofgame_description"
                android:id="@+id/typeOfGame"
                android:layout_width="@dimen/feed_item_profile_pic"
                android:layout_height="@dimen/feed_item_profile_pic"
                android:scaleType="fitCenter" />

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:paddingLeft="@dimen/feed_item_profile_info_padd" >

            <RelativeLayout
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content">

                <TextView
                    android:id="@+id/name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textSize="@dimen/feed_itemview_profile_name"
                    android:textStyle="bold" />

                 <TextView
                    android:id="@+id/type"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textSize="@dimen/feed_itemview_type_text"
                    android:layout_alignParentRight="true"
                    android:textColor="@color/feed_item_text_color" />

             </RelativeLayout>

                <TextView
                    android:id="@+id/timestamp"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:textColor="@color/timestamp"
                    android:textSize="@dimen/feed_itemview_timestamp" />
            </LinearLayout>
        </LinearLayout>

        <TextView
            android:id="@+id/txtStatusMsg"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="5dp"
            android:paddingLeft="@dimen/feed_item_status_pad_left_right"
            android:paddingRight="@dimen/feed_item_status_pad_left_right"
            android:paddingTop="@dimen/feed_item_status_pad_top"
            android:textSize="@dimen/feed_itemview_desc" />

        <RelativeLayout
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content" 
            android:orientation="horizontal" >

            <Button
            android:id="@+id/buttonRating"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="@dimen/feed_item_rating_pad_left"
            android:paddingTop="@dimen/feed_item_rating_pad_top" />


        </RelativeLayout>

         <View
            android:layout_width="fill_parent"
            android:layout_height="1dp"
            android:background="@color/feed_divider"
            android:layout_marginLeft="1dp"
            android:layout_marginRight="1dp" />

         <ListView
            android:id="@+id/list_comment"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:divider="@color/feed_divider"
            android:dividerHeight="1px" />

    </LinearLayout>

</LinearLayout>

The ListView doesn't scroll down, see the below picture

enter image description here

How fix this problem? Maybe add ScrollView ? Or make the upper part of this element in view and add header of listvew?

Shravan
  • 540
  • 6
  • 24

2 Answers2

0

Adding listview in scrollview or vice versa is bad and should not be done. Go with adding the top part as header for the listview.

vishnus
  • 728
  • 2
  • 7
  • 20
0

As vishnus suggested :: Adding a List in a scrollview is not recomended


  • Because:: Android gets confused which scroll event to fire (listview or Scroll view)
  • Overview:: You can achieve your goal with Just Listview

Solution::

              - Try to add a header to a listview

              - Second way to use multiple layouts in listview

Example1 :: See this project

Example2:: See this Project


Hope it helps, Revert back to me if you need anymore help

Community
  • 1
  • 1
Devrath
  • 42,072
  • 54
  • 195
  • 297