0

Hi I have imageview with text title, description and rating followed by list of names. So I placed with scrollview since if text is too long to scroll and view. But I couldn't handle listview where it gets hided showing only one item. My code is as follows:

   <?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:orientation="vertical" >


<Scrollview
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="5dp" >


        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="180dp"
            android:layout_gravity="center_horizontal" >

            <ProgressBar
                android:id="@+id/progressBar1"
                style="?android:attr/progressBarStyleLarge"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_gravity="center" />

            <ImageView
                android:id="@+id/image_of_movie"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center_horizontal"
                android:contentDescription="@string/app_name"
                android:padding="8dp"
                android:src="@drawable/images" />
        </FrameLayout>

        <TextView
            android:id="@+id/name_of_movie"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:textStyle="bold" />

        <ListView // problem occurs here displaying only one item where others hide
            android:id="@+id/cast_details"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <TextView
            android:id="@+id/synopsis"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
      />

        <RatingBar
        android:id="@+id/rating"
        android:layout_marginTop="10dp"
        android:layout_width="wrap_content"
        android:numStars="10"
        style="?android:attr/ratingBarStyleSmall"
        android:layout_height="wrap_content"
        android:isIndicator="true" />
        <TextView
    android:id="@+id/ratingText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_marginTop="20dp" 
    android:text="Rating: "/>

    </LinearLayout>
</Scrollview>

When I remove ScrollView, all items are displaying with expanded form in listview but other text which is present below listview gets hided.

How to solve this?

Thanks in advance.

Star
  • 735
  • 3
  • 13
  • 34
  • Put whatever you want to scroll (besides the `ListView`) in a `ScrollView`. [The Docs](http://developer.android.com/reference/android/widget/ScrollView.html) are very clear on not using `ListView` inside of a `ScrollView` – codeMagic Oct 21 '14 at 20:29
  • \@Star if you really need to use ListView inside ScrollView then you have to give fixed height of ListView instead wrap_content – Amit Yadav Oct 21 '14 at 20:56

0 Answers0