Java Code Examples for android.support.v7.widget.RecyclerView#setFocusable()

The following examples show how to use android.support.v7.widget.RecyclerView#setFocusable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FragmentSettings.java    From fingen with Apache License 2.0 5 votes vote down vote up
@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(false));
    setDivider(null);

    // We don't want this. The children are still focusable.
    listView.setFocusable(false);
}
 
Example 2
Source File: TransitionAnimationActivity.java    From Android-Animation-Set with Apache License 2.0 5 votes vote down vote up
private void initRecyclerView() {
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv_share_elements);
    recyclerView.setFocusable(false);
    recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.addItemDecoration(new GridSpacingItemDecoration(2, 5, false));
    recyclerView.setAdapter(new MyRecyclerViewAdapter(this));
}
 
Example 3
Source File: SettingsFragment.java    From IslamicLibraryAndroid with GNU General Public License v3.0 5 votes vote down vote up
@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);
}
 
Example 4
Source File: MainActivity.java    From LivePlayback with Apache License 2.0 5 votes vote down vote up
private void loadRecyclerViewMenuItem() {
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.ry_menu_item);
    GridLayoutManager layoutManager = new GridLayoutManager(this, 1);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setFocusable(false);
    mMetroViewBorderImpl.attachTo(recyclerView);
    createOptionItemData(recyclerView, R.layout.detail_menu_item);
}
 
Example 5
Source File: Fragment_day.java    From privacy-friendly-netmonitor with GNU General Public License v3.0 5 votes vote down vote up
private void fillRecyclerList(View view, List<ReportEntity> reportEntityList) {

        mRecyclerView = (RecyclerView) view.findViewById(R.id.my_recycler_view);
        mRecyclerView.setFocusable(false);
        mRecyclerView.setNestedScrollingEnabled(false);
        mRecyclerView.setHasFixedSize(true);
        mLayoutManager = new LinearLayoutManager(getContext());
        mRecyclerView.setLayoutManager(mLayoutManager);
        mAdapter = new FragmentDayListAdapter(reportEntityList, getContext());
        mRecyclerView.setAdapter(mAdapter);
    }
 
Example 6
Source File: Fragment_month.java    From privacy-friendly-netmonitor with GNU General Public License v3.0 5 votes vote down vote up
private void fillRecyclerList(View view, List<ReportEntity> reportEntityList) {

        mRecyclerView = (RecyclerView) view.findViewById(R.id.my_recycler_view);
        mRecyclerView.setFocusable(false);
        mRecyclerView.setNestedScrollingEnabled(false);
        mRecyclerView.setHasFixedSize(true);
        mLayoutManager = new LinearLayoutManager(getContext());
        mRecyclerView.setLayoutManager(mLayoutManager);
        mAdapter = new FragmentDayListAdapter(reportEntityList, getContext());
        mRecyclerView.setAdapter(mAdapter);
    }
 
Example 7
Source File: Fragment_week.java    From privacy-friendly-netmonitor with GNU General Public License v3.0 5 votes vote down vote up
private void fillRecyclerList(View view, List<ReportEntity> reportEntityList) {

        mRecyclerView = (RecyclerView) view.findViewById(R.id.my_recycler_view);
        mRecyclerView.setFocusable(false);
        mRecyclerView.setNestedScrollingEnabled(false);
        mRecyclerView.setHasFixedSize(true);
        mLayoutManager = new LinearLayoutManager(getContext());
        mRecyclerView.setLayoutManager(mLayoutManager);
        mAdapter = new FragmentDayListAdapter(reportEntityList, getContext());
        mRecyclerView.setAdapter(mAdapter);
    }
 
Example 8
Source File: DemoRecyclerViewActivity.java    From TvWidget with Apache License 2.0 5 votes vote down vote up
private void testRecyclerViewLinerLayout() {
    //test linearlayout
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    // 创建一个线性布局管理器
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setFocusable(false);
    border.attachTo(recyclerView);
    createData(recyclerView);

}
 
Example 9
Source File: DemoRecyclerViewActivity.java    From TvWidget with Apache License 2.0 5 votes vote down vote up
private void testRecyclerViewGridLayout() {
    //test grid
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    GridLayoutManager gridlayoutManager = new TvGridLayoutManagerScrolling(this, 4);
    gridlayoutManager.setOrientation(GridLayoutManager.HORIZONTAL);
    recyclerView.setLayoutManager(gridlayoutManager);
    recyclerView.setFocusable(false);

    border.attachTo(recyclerView);
    createData(recyclerView);

}
 
Example 10
Source File: DemoTwoRecyclerViewActivity.java    From TvWidget with Apache License 2.0 5 votes vote down vote up
private void testRecyclerViewLinerLayout() {
    //test linearlayout
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.firstRecyclerView);
    // 创建一个线性布局管理器

    GridLayoutManager layoutManager = new GridLayoutManager(this,1);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setFocusable(false);
    border.attachTo(recyclerView);

    createData(recyclerView, R.layout.item3);

}
 
Example 11
Source File: DemoTwoRecyclerViewActivity.java    From TvWidget with Apache License 2.0 5 votes vote down vote up
private void testRecyclerViewGridLayout() {
    //test grid
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.secondRecyclerView);
    GridLayoutManager gridlayoutManager = new TvGridLayoutManagerScrolling(this, 4);
    gridlayoutManager.setOrientation(GridLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(gridlayoutManager);
    recyclerView.setFocusable(false);


    border.attachTo(recyclerView);

    createData(recyclerView,R.layout.item);

}
 
Example 12
Source File: TransitionAnimationActivity.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
private void initRecyclerView() {
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv_share_elements);
    recyclerView.setFocusable(false);
    recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.addItemDecoration(new GridSpacingItemDecoration(2, 5, false));
    recyclerView.setAdapter(new MyRecyclerViewAdapter(this));
}
 
Example 13
Source File: DetailListActivity.java    From TVSample with Apache License 2.0 5 votes vote down vote up
private void loadRecyclerViewMenuItem() {
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.ry_menu_item);
    GridLayoutManager layoutManager = new GridLayoutManager(this, 1);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setFocusable(false);
    mMetroViewBorderImpl.attachTo(recyclerView);
    createOptionItemData(recyclerView, R.layout.detail_menu_item);
}
 
Example 14
Source File: DetailListActivity.java    From TVSample with Apache License 2.0 5 votes vote down vote up
private void loadDataForRecyclerViewGridLayout() {
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.ry_detail_list);
    GridLayoutManager gridlayoutManager = new AutoLayoutManager(this, 4);
    gridlayoutManager.setOrientation(GridLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(gridlayoutManager);
    recyclerView.setFocusable(false);
    mMetroViewBorderImpl.attachTo(recyclerView);
    createData(recyclerView, R.layout.detail_list_item);
}
 
Example 15
Source File: SettingsActivity.java    From BrainPhaser with GNU General Public License v3.0 4 votes vote down vote up
/**
 * This method is called when the activity is created
 *
 * @param savedInstanceState handed over to super constructor
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_settings);

    Toolbar myChildToolbar =
        (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(myChildToolbar);

    // Get a support ActionBar corresponding to this toolbar
    ActionBar ab = getSupportActionBar();

    // Enable the Up button
    ab.setDisplayHomeAsUpEnabled(true);

    //loading of the components
    RecyclerView settingsList = (RecyclerView) findViewById(R.id.settingsList);
    settingsList.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));

    // use a linear layout manager
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    layoutManager.setAutoMeasureEnabled(true);
    settingsList.setLayoutManager(layoutManager);
    settingsList.setNestedScrollingEnabled(false);

    //Create the View
    //Adapter which sets all users into the list
    mSettingsAdapter = new SettingsAdapter(mUserManager.getCurrentUser().getSettings(), this, mSettingsLogic);
    settingsList.setAdapter(mSettingsAdapter);

    // Avoid scrolldown
    settingsList.setFocusable(false);
    (findViewById(R.id.heading)).requestFocus();

    final SettingsActivity self = this;
    Button resetButton = (Button) findViewById(R.id.resetButton);
    resetButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            self.resetSettings();
        }
    });
}