List of usage examples for android.widget GridView setFastScrollEnabled
public void setFastScrollEnabled(final boolean enabled)
From source file:com.battlelancer.seriesguide.ui.ListsFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mAdapter = new ListItemAdapter(getActivity(), null, 0); // setup grid view GridView list = (GridView) getView().findViewById(android.R.id.list); list.setAdapter(mAdapter);/*from w w w .j a v a2s. c o m*/ list.setOnItemClickListener(this); list.setEmptyView(getView().findViewById(android.R.id.empty)); list.setFastScrollAlwaysVisible(false); list.setFastScrollEnabled(true); getLoaderManager().initLoader(LOADER_ID, getArguments(), this); }
From source file:de.baumann.thema.RequestActivity.java
@SuppressWarnings("unchecked") private void populateView(ArrayList arrayListFinal) { ArrayList<AppInfo> local_arrayList; local_arrayList = arrayListFinal;//from ww w .j a v a 2 s . co m GridView grid = (GridView) findViewById(R.id.appgrid); assert grid != null; grid.setVerticalSpacing(GridView.AUTO_FIT); grid.setHorizontalSpacing(GridView.AUTO_FIT); grid.setStretchMode(GridView.STRETCH_COLUMN_WIDTH); grid.setFastScrollEnabled(true); grid.setFastScrollAlwaysVisible(true); if (DEBUG) Log.v(TAG, "height: " + getDisplaySize("height") + "; width: " + getDisplaySize("width")); AppAdapter appInfoAdapter; if (isPortrait()) { grid.setNumColumns(numCol_Portrait); if (isTablet(context)) { grid.setNumColumns(numCol_Portrait); //Here you can change the number of columns for Tablets if (DEBUG) Log.v(TAG, "isTablet"); } if (isXLargeTablet(context)) { grid.setNumColumns(numCol_Portrait); //Here you can change the number of columns for Large Tablets if (DEBUG) Log.v(TAG, "isXLargeTablet"); } appInfoAdapter = new AppAdapter(this, R.layout.request_item_list, local_arrayList); } else { grid.setNumColumns(numCol_Landscape); if (isTablet(context)) { grid.setNumColumns(numCol_Landscape); //Here you can change the number of columns for Tablets if (DEBUG) Log.v(TAG, "isTablet"); } if (isXLargeTablet(context)) { grid.setNumColumns(numCol_Landscape); //Here you can change the number of columns for Large Tablets if (DEBUG) Log.v(TAG, "isXLargeTablet"); } appInfoAdapter = new AppAdapter(this, R.layout.request_item_grid, local_arrayList); } grid.setAdapter(appInfoAdapter); grid.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> AdapterView, View view, int position, long row) { AppInfo appInfo = (AppInfo) AdapterView.getItemAtPosition(position); CheckBox checker = (CheckBox) view.findViewById(R.id.CBappSelect); ViewSwitcher icon = (ViewSwitcher) view.findViewById(R.id.viewSwitcherChecked); LinearLayout localBackground = (LinearLayout) view.findViewById(R.id.card_bg); Animation aniIn = AnimationUtils.loadAnimation(context, R.anim.request_flip_in_half_1); Animation aniOut = AnimationUtils.loadAnimation(context, R.anim.request_flip_in_half_2); checker.toggle(); appInfo.setSelected(checker.isChecked()); icon.setInAnimation(aniIn); icon.setOutAnimation(aniOut); if (appInfo.isSelected()) { if (DEBUG) Log.v(TAG, "Selected App: " + appInfo.getName()); localBackground .setBackgroundColor(ContextCompat.getColor(context, R.color.request_card_pressed)); if (icon.getDisplayedChild() == 0) { icon.showNext(); } } else { if (DEBUG) Log.v(TAG, "Deselected App: " + appInfo.getName()); localBackground .setBackgroundColor(ContextCompat.getColor(context, R.color.request_card_unpressed)); if (icon.getDisplayedChild() == 1) { icon.showPrevious(); } } } }); }