Android examples for android.widget:ListView
Scroll ListView By Key
import android.view.KeyEvent; import android.widget.ListView; public class Main{ public static boolean ScrollListViewByKey(ListView lv, int keyCode) { if (lv != null) { int offset = (int) (lv.getHeight() * 0.95); if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { lv.smoothScrollBy(offset, 500); return true; } else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { lv.smoothScrollBy(-1 * offset, 500); return true; }/* w w w . j av a 2 s .c o m*/ } return false; } }