Fast scroll always on and with padding only on APIs >= 11

This commit is contained in:
Daniel Martí 2013-07-09 16:36:21 +02:00
parent 3caa411390
commit 80437abcc0
2 changed files with 12 additions and 4 deletions

View File

@ -131,8 +131,12 @@ public class SearchResults extends ListActivity {
for (DB.App app : apps) {
applist.addItem(app);
}
getListView().setFastScrollAlwaysVisible(true);
getListView().setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET);
if (Utils.hasApi(11)) {
getListView().setFastScrollAlwaysVisible(true);
getListView().setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET);
} else {
getListView().setFastScrollEnabled(true);
}
applist.notifyDataSetChanged();
setListAdapter(applist);

View File

@ -49,8 +49,12 @@ abstract class AppListFragment extends Fragment implements AdapterView.OnItemCli
protected ListView createAppListView() {
ListView list = new ListView(getActivity());
list.setFastScrollAlwaysVisible(true);
list.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET);
if (Utils.hasApi(11)) {
list.setFastScrollAlwaysVisible(true);
list.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET);
} else {
list.setFastScrollEnabled(true);
}
list.setOnItemClickListener(this);
list.setAdapter(getAppListAdapter());
return list;