當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。