本文整理匯總了Java中android.support.v7.widget.RecyclerView.setFocusable方法的典型用法代碼示例。如果您正苦於以下問題:Java RecyclerView.setFocusable方法的具體用法?Java RecyclerView.setFocusable怎麽用?Java RecyclerView.setFocusable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.widget.RecyclerView
的用法示例。
在下文中一共展示了RecyclerView.setFocusable方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreateView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.d(TAG, "onCreateView");
View v = inflater.inflate(R.layout.samba_discovery_fragment, container, false);
mDiscoveryList = (RecyclerView)v.findViewById(R.id.discovery_list);
mLayoutManager = new LinearLayoutManager(getActivity());
mDiscoveryList.setLayoutManager(mLayoutManager);
mDiscoveryList.setHasFixedSize(false); // there are separators
mDiscoveryList.setAdapter(mAdapter);
mDiscoveryList.setFocusable(false);
if (savedInstanceState!=null) {
mAdapter.onRestoreInstanceState(savedInstanceState); // Restore the adapter "saved instance" parameters
mLayoutManager.onRestoreInstanceState(savedInstanceState.getParcelable("mLayoutManager")); // Restore the layout manager state
}
loadIndexedShortcuts();
return v;
}
示例2: onViewCreated
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final RecyclerView listView = getListView();
// We don't want this. The children are still focusable.
listView.setFocusable(false);
}
示例3: renderMenuListView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void renderMenuListView(View view) {
RecyclerView listView = (RecyclerView) view.findViewById(R.id.recycler_view);
PictureChooserMenuAdapter adapter =
new PictureChooserMenuAdapter(getActivity().getLayoutInflater(), this::handleClickItem);
adapter.addLastCollection(mMenuList);
final LinearLayoutManager llm = new LinearLayoutManager(view.getContext());
llm.setOrientation(LinearLayoutManager.VERTICAL);
listView.setLayoutManager(llm);
listView.setAdapter(adapter);
listView.setHasFixedSize(true);
listView.setFocusable(false);
}
示例4: onViewCreated
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final RecyclerView listView = getListView();
// We're using alternative divider.
listView.addItemDecoration(new PreferenceDividerDecoration(getContext()).drawBottom(true).drawBetweenCategories(true));
setDivider(null);
// We don't want this. The children are still focusable.
listView.setFocusable(false);
}
示例5: onViewCreated
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
// this solves the "preference screen background is a darker gray" problem:
// https://github.com/consp1racy/android-support-preference/issues/22
super.onViewCreated(view, savedInstanceState);
final RecyclerView listView = getListView();
// We don't want this. The children are still focusable.
listView.setFocusable(false);
}
示例6: handleShareWithBottomSheets
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void handleShareWithBottomSheets(@NonNull final Activity activity, @NonNull
BottomSheetDialog
shareDialog, @NonNull final Intent shareIntent) {
List<ActionMenuItem> menus = new ArrayList<>();
shareDialog.setCanceledOnTouchOutside(false);
RecyclerView gridView = ((RecyclerView) shareDialog.findViewById(R.id.recyclerView));
if (gridView == null) {
throw new NullPointerException("you should declare a id named recyclerView in your " +
"bottomSheets layout!");
}
int grid = 4;
gridView.setLayoutManager(new GridLayoutManager(activity, grid));
gridView.setNestedScrollingEnabled(false);
gridView.setFocusable(false);
gridView.setHasFixedSize(true);
int v = DisplayUtil.dp2px(activity, 3);
int h = DisplayUtil.dp2px(activity, 8);
SpaceGridItemDecoration spaceItemDecoration = new SpaceGridItemDecoration(grid, h, v,
h, v);
ShareGridAdapter gridAdapter = new ShareGridAdapter();
gridView.setAdapter(gridAdapter);
gridView.addItemDecoration(spaceItemDecoration);
PackageManager pm = activity.getPackageManager();
final List<ResolveInfo> list = pm.queryIntentActivities(shareIntent, 0);
for (int i = 0; i < list.size(); i++) {
ActionMenuItem item = new ActionMenuItem(activity, 0, i, 0, 0, list.get(i).loadLabel
(pm));
item.setIcon(list.get(i).loadIcon(pm));
menus.add(item);
}
gridAdapter.setClickListener(new OnSampleClickListener<ActionMenuItem>() {
@Override
public void onClick(View view, ActionMenuItem obj) {
ActivityInfo activityInfo = list.get(obj.getItemId()).activityInfo;
ComponentName name = new ComponentName(activityInfo.applicationInfo.packageName,
activityInfo.name);
shareIntent.setComponent(name);
activity.startActivity(shareIntent);
}
});
gridAdapter.setMenuItems(menus);
gridAdapter.notifyDataSetChanged();
shareDialog.show();
}