I have this pretty basic view:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/question_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Your question: "
/>
<TextView
android:id="@+id/question"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
/>
<EditText
android:id="@+id/question_text"
android:layout_height="wrap_content"
android:hint="@string/question_comment_hint"
android:inputType="textMultiLine"
android:lines="4"
android:layout_width="fill_parent">
</EditText>
<Button
android:id="@+id/submit"
android:layout_height="wrap_content"
android:text="@string/submit"
android:onClick="sendFeedback"
android:layout_width="fill_parent">
</Button>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/please_wait"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Please wait while the discussion loads..."
/>
<ListView
android:id="@android:id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@+id/label"
android:textSize="20px" >
</ListView>
</LinearLayout>
</ScrollView>
</LinearLayout>
What I was hoping to do with it is to allow the user to scroll through the entire list of comments. As of now, when there are more comments then space on the screen, the screen does not scroll down.
Any idea what I should change to enable scrolling of the comments?
Thanks!
I would do away with the scrollview completely – based on what I THINK you’re try to accomplish, since the listview will handle scrolling on its own. Like such:
The difference now, is that the TextView with id “please_wait” will not scroll with the list. If you need it to scroll with the list, I would recommend using a dynamically built TableLayout in java for your list, then add that and your textview to a ScrollView. The TableLayout doesn’t scroll on its own, and thats why its a better solution than using a ListView inside a ScrollView. If you want to do it this way, let me know and I will post some example code.