Android ListActivity Scrollview How to get a list for scrolling

I went through a tutorial at http://www.vogella.de/articles/AndroidListView/article.html learning how to use ListActivity. I am trying to get a list for scrolling, but realized that you cannot use scrollview in the layout file for this to happen. After searching on Google, I realized that android does not allow this, but I could not find an answer that seems to explain how to scroll.

Code below:

public class MyListActivityActivity extends ListActivity {
/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
    String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
            "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
            "Linux", "OS/2", "iPhone", "WindowsMobile",
            "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
            "Linux", "OS/2" , "iPhone", "WindowsMobile",
            "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
            "Linux", "OS/2"  };
    /*LayoutInflater factory = getLayoutInflater();
    LinearLayout footer = 
            (LinearLayout) factory.inflate(R.layout.main, null);
     getListView().addFooterView(footer); */


    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            R.layout.rowlayout, R.id.label, values);
    setListAdapter(adapter);
}

    protected void onListItemClick(ListView l, View v, int position, long id) {
    String item = (String) getListAdapter().getItem(position);
    Toast.makeText(this, item + " selected", Toast.LENGTH_LONG).show();
}
}

// xml file:   

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

<ImageView
    android:id="@+id/icon"
    android:layout_width="22px"
    android:layout_height="22px"
    android:layout_marginLeft="4px"
    android:layout_marginRight="10px"
    android:layout_marginTop="4px"
    android:src="@drawable/ic_launcher" >
</ImageView>

<TextView
    android:id="@+id/label"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@+id/label"
    android:textSize="20px" >
</TextView>

</LinearLayout>

Currently, the more values ​​you put in an array, the smaller the list to make sure it fits on the screen. I want the text to remain the same size, and let it be a long list that I can scroll through.

- addHeader addFooter, . - , , ?

.

+1
3

ListView , ScrollView

+3

ScrollView. ListActivity , , ListView , , .

, ScrollViews ListViews, , .

+1

The list scans its own scrolling. if you want to set the scroll layout you can use this code This is the job for you.

<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/lwidget36"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/lwidget35"
android:background="#000321"
android:overScrollMode="never" >

<LinearLayout 
android:layout_width="wrap_content"
android:layout_height="wrap_content" >

<ImageView
android:id="@+id/icon"
android:layout_width="22px"
android:layout_height="22px"
android:layout_marginLeft="4px"
android:layout_marginRight="10px"
android:layout_marginTop="4px"
android:src="@drawable/ic_launcher" >
</ImageView>

<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@+id/label"
android:textSize="20px" >
</TextView>

</LinearLayout>
</ScrollView>
-1
source

All Articles