Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding new item to the top of the RecyclerView

Tags:

People also ask

How do you overlap items in RecyclerView?

recyclerView. setLayoutManager(new LinearLayoutManager(this)); recyclerView. addItemDecoration(new ItemDecorator(-80)); This causes top item to stack lowest and next item after the top item overlaps it.

How do you update one item in RecyclerView?

Update single item Change the "Sheep" item so that it says "I like sheep." String newValue = "I like sheep."; int updateIndex = 3; data. set(updateIndex, newValue); adapter. notifyItemChanged(updateIndex);

What is expandable RecyclerView?

Expandable RecyclerView is one of the most important feature in Android which can be easily created for our application . It contains two views one is parent view and other is child view. Parent is visible by default but the child view has to be expanded and collapsed. It will expand when we click on parent view.


I am adding an item to recyclerview position 0 programamticly

public void addQuestion(Question question){
    this.questionList.add(0, question);
    notifyItemInserted(0);
}

This is working very well and the items do appear in the list at top BUT the user has to scroll up to see the new item.

Is there any trick how the item appear at top and recyclerview is scrolling up automaticly ?