当前位置: 首页>>代码示例>>Java>>正文


Java LinearLayoutManager.scrollToPosition方法代码示例

本文整理汇总了Java中android.support.v7.widget.LinearLayoutManager.scrollToPosition方法的典型用法代码示例。如果您正苦于以下问题:Java LinearLayoutManager.scrollToPosition方法的具体用法?Java LinearLayoutManager.scrollToPosition怎么用?Java LinearLayoutManager.scrollToPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v7.widget.LinearLayoutManager的用法示例。


在下文中一共展示了LinearLayoutManager.scrollToPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showRecyclerAdapter

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
private void showRecyclerAdapter() {

        mAdapter = new NavAdapter(this,mArrayList, Typeface.createFromAsset(getAssets(),"fonts/Roboto-Light.ttf"));
        RecyclerView rec = (RecyclerView)(findViewById(R.id.recyclerNav));
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        rec.setLayoutManager(linearLayoutManager);
        rec.setAdapter(mAdapter);
        mAdapter.onRecyclerClick(this);

        if(mArrayList.size() == 3)
            linearLayoutManager.scrollToPosition(mArrayList.size()+1);

        DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(rec.getContext(),
                DividerItemDecoration.VERTICAL);
        rec.addItemDecoration(dividerItemDecoration);


        ItemTouchHelper helper = new ItemTouchHelper(callBack());
        helper.attachToRecyclerView(rec);

    }
 
开发者ID:Salman544,项目名称:Todo_App,代码行数:22,代码来源:MainActivity.java

示例2: setUpHistory

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
private void setUpHistory(RecyclerView historyView) {
    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    layoutManager.setReverseLayout(true);
    layoutManager.setStackFromEnd(true);
    historyView.setLayoutManager(layoutManager);
    historyView.addItemDecoration(new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL));

    final FloatingHistoryAdapter historyAdapter = new FloatingHistoryAdapter(mContext, mSolver, mHistory, mHistoryCallback);
    mHistory.setObserver(new History.Observer() {
        @Override
        public void notifyDataSetChanged() {
            historyAdapter.notifyDataSetChanged();
        }
    });
    historyView.setAdapter(historyAdapter);

    layoutManager.scrollToPosition(historyAdapter.getItemCount() - 1);
}
 
开发者ID:tranleduy2000,项目名称:floating_calc,代码行数:20,代码来源:FloatingPageAdapter.java

示例3: initializeRecyclerView

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
private void initializeRecyclerView(final View layout) {
  // Get RecyclerView
  mRecyclerView = UI.findViewById(layout, R.id.recycler_view);
  // Choose the LayoutManager
  LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
  layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
  layoutManager.scrollToPosition(0);
  mRecyclerView.setLayoutManager(layoutManager);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:MainFragment.java


注:本文中的android.support.v7.widget.LinearLayoutManager.scrollToPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。