1

I have tried so many things to get my android ListView to scroll. However I have been unsuccessful in my attempt. Here is my xml code below.

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >


    <ListView
        android:id="@+id/listview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fastScrollEnabled="true"
        android:listSelector="@color/theme_colour"
        android:scrollbarStyle="outsideInset">
        </ListView>


</RelativeLayout>


I have also added my java code below. I am not sure how to fix this problem and your help would be greatly appreciated.

package com.outdeh;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;

import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseQueryAdapter;

/**
 * Created by horacedaley on 2/15/14.
 */
public class EventsActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listview_main);
        populateListView();


    }

    public void populateListView(){
        ParseQueryAdapter<ParseObject> adapter =
                new ParseQueryAdapter<ParseObject>(this, new ParseQueryAdapter.QueryFactory<ParseObject>() {
                    public ParseQuery<ParseObject> create() {
                        // Here we can configure a ParseQuery to our heart's desire.
                        ParseQuery query = new ParseQuery("Events");
                        query.orderByAscending("eDate");
                        return query;
                    }
                });


        adapter.setTextKey("eTitle");
        ListView listView = (ListView) findViewById(R.id.listview);
        listView.setFastScrollEnabled(true);
        listView.setAdapter(adapter);

    }


}
  • check this answer. http://stackoverflow.com/questions/6210895/listview-inside-scrollview-is-not-scrolling-on-android – Jigar Shekh Feb 23 '14 at 13:00
  • check this tutorial aslo. http://androidexample.com/Create_A_Simple_Listview_-_Android_Example/index.php?view=article_discription&aid=65&aaid=90 – Jigar Shekh Feb 23 '14 at 13:02
  • This still did not help me. I am able to get the view to work and everything. But it doesn't help me with the whole scroll view. As you can see i have a simple list view, all I want is for it to scroll... – user3308580 Feb 23 '14 at 16:02

1 Answers1

1

Try changing android:layout_height="wrap_content"s to android:layout_height="match_parent". I guess it doesn't scroll because when you set the height to "wrap_content" the view will go beyond the visible area in activity, and since all items are considered displayed (in spite of not being in the visible area), there won't be scrolling available.

James Fenn
  • 109
  • 1
  • 14
hirbodk
  • 126
  • 5