RecyclerView - Orange168/NotesOnReading GitHub Wiki

RecyclerView

Demo

Important Method

// allows for optimizations if all items are of the same size:
recyclerView.setHasFixedSize(true);
View view = recyclerView.findChildViewUnder(e.getX(), e.getY()); //e is MotionEvent
// you can set the first visible item like this:
layoutManager.scrollToPosition(6);
recyclerView.addItemDecoration(itemDecoration); //set divider
 recyclerView.setItemAnimator(new DefaultItemAnimator());
 int pos = recyclerView.getChildAdapterPosition(childView) ;

Boilerplate

ActionMode

  1. implement ActionMode.Callback
  2. Activity.startActionMode(this); //mWindow.getDecorView().startActionMode(callback);
  3. onCreateActionMode actionMode.getMenuInflater().inflate(R.menu., menu); return ture
  4. actionMode.finish(); actionMode.setTitle(title);

More Learn

 <string name="selected_count">%1$s selected</string>
 getString(R.string.selected_count, 100);

-%1$s is xliff:g标签

%n$ms:代表输出的是字符串,n代表是第几个参数,m表示输出之前放置空格数 %s = %1$0s=%1$s,%1$1s ==>100 selected, %1$6s ==> (6space)100 selected

⚠️ **GitHub.com Fallback** ⚠️