I want to be able to scroll through a list using my finger on the screen, but right now I need to use the track ball at the bottom of the phone. Is there something that I need to implement or something that I am doing wrong? Here is my XML with the ScrollView:
<ScrollView android:layout_height="250dip"
android:layout_width="fill_parent">
<LinearLayout android:layout_height="fill_parent"
android:layout_width="fill_parent" android:orientation="vertical"
android:id="@+id/linearLayout1">
<ListView android:layout_width="fill_parent" android:id="@+id/android:list"
android:layout_height="250dip"></ListView>
<TextView android:id="@+id/android:empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_user_names" />
</LinearLayout>
</ScrollView>
And below is from my class:
The list is populated using this method:
private void populateList(){
String[] projection = new String[]{NameProviderMetaData.NameTableMetaData._ID, NameProviderMetaData.NameTableMetaData.NAME};
Cursor c = managedQuery(NAMES_URI,projection,null,null,NameProviderMetaData.NameTableMetaData.NAME);
String[] cols = new String[] {NameProviderMetaData.NameTableMetaData.NAME};
int[] views = new int[] {android.R.id.text1};
adapter = new SimpleCursorAdapter(this,android.R.layout.simple_list_item_1,c,cols,views);
setListAdapter(adapter);
}
I have an onTouchEvent method elsewhere in the class:
@Override
public boolean onTouchEvent(MotionEvent event) {
if (mGestureDetector.onTouchEvent(event))
return true;
else
return false;
}
You cannot use a ListView inside a ScrollView (any two views that have same orientation scrolling). You should reconsider your layout!
You could do this for example: