Shift recyclerview focus to last element in the listStrange out of memory issue while loading an image to a Bitmap objectHow to make an Android Spinner with initial text “Select One”Stop EditText from gaining focus at Activity startupIs quitting an application frowned upon?How to add dividers and spaces between items in RecyclerView?Why doesn't RecyclerView have onItemClickListener()?How to create RecyclerView with multiple view type?Is there an addHeaderView equivalent for RecyclerView?Should we use RecyclerView to replace ListView?RecyclerView for chat app
How to implement a feedback to keep the DC gain at zero for this conceptual passive filter?
Multiplicative persistence
Removing files under particular conditions (number of files, file age)
"Spoil" vs "Ruin"
Freedom of speech and where it applies
2.8 Why are collections grayed out? How can I open them?
What does "Scientists rise up against statistical significance" mean? (Comment in Nature)
Did arcade monitors have same pixel aspect ratio as TV sets?
When were female captains banned from Starfleet?
Did Swami Prabhupada reject Advaita?
Aragorn's "guise" in the Orthanc Stone
What is Cash Advance APR?
Why should universal income be universal?
Biological Blimps: Propulsion
copy and scale one figure (wheel)
Electoral considerations aside, what are potential benefits, for the US, of policy changes proposed by the tweet recognizing Golan annexation?
Reverse int within the 32-bit signed integer range: [−2^31, 2^31 − 1]
Terse Method to Swap Lowest for Highest?
How do I color the graph in datavisualization?
How to indicate a cut out for a product window
Is it possible to have a strip of cold climate in the middle of a planet?
Problem with TransformedDistribution
Strong empirical falsification of quantum mechanics based on vacuum energy density
If magnesium reacts with oxygen to produce magnesium oxide only on the application of heat, then why isn't it categorised as an endothermic reaction?
Shift recyclerview focus to last element in the list
Strange out of memory issue while loading an image to a Bitmap objectHow to make an Android Spinner with initial text “Select One”Stop EditText from gaining focus at Activity startupIs quitting an application frowned upon?How to add dividers and spaces between items in RecyclerView?Why doesn't RecyclerView have onItemClickListener()?How to create RecyclerView with multiple view type?Is there an addHeaderView equivalent for RecyclerView?Should we use RecyclerView to replace ListView?RecyclerView for chat app
I am using recyclerview to display messages in a chat window. However, when a new message is being edited, the recycler view focus should be on the last element. I expect there would be some way to shift the focus of a recyclerview to last element instead of first.
add a comment |
I am using recyclerview to display messages in a chat window. However, when a new message is being edited, the recycler view focus should be on the last element. I expect there would be some way to shift the focus of a recyclerview to last element instead of first.
2
userecyclerView.smoothScrollToPosition(position);position is your index of last item inserted.
– Vipul Asri
Dec 16 '15 at 8:38
you can add this as the answer as it solved my problem.
– Divya Vikash
Dec 16 '15 at 10:48
1
@VipulAsri please put your comment as answer as it solved the question. You would help other guys
– piotrek1543
Dec 16 '15 at 21:32
add a comment |
I am using recyclerview to display messages in a chat window. However, when a new message is being edited, the recycler view focus should be on the last element. I expect there would be some way to shift the focus of a recyclerview to last element instead of first.
I am using recyclerview to display messages in a chat window. However, when a new message is being edited, the recycler view focus should be on the last element. I expect there would be some way to shift the focus of a recyclerview to last element instead of first.
asked Dec 16 '15 at 8:23
Divya VikashDivya Vikash
4361623
4361623
2
userecyclerView.smoothScrollToPosition(position);position is your index of last item inserted.
– Vipul Asri
Dec 16 '15 at 8:38
you can add this as the answer as it solved my problem.
– Divya Vikash
Dec 16 '15 at 10:48
1
@VipulAsri please put your comment as answer as it solved the question. You would help other guys
– piotrek1543
Dec 16 '15 at 21:32
add a comment |
2
userecyclerView.smoothScrollToPosition(position);position is your index of last item inserted.
– Vipul Asri
Dec 16 '15 at 8:38
you can add this as the answer as it solved my problem.
– Divya Vikash
Dec 16 '15 at 10:48
1
@VipulAsri please put your comment as answer as it solved the question. You would help other guys
– piotrek1543
Dec 16 '15 at 21:32
2
2
use
recyclerView.smoothScrollToPosition(position); position is your index of last item inserted.– Vipul Asri
Dec 16 '15 at 8:38
use
recyclerView.smoothScrollToPosition(position); position is your index of last item inserted.– Vipul Asri
Dec 16 '15 at 8:38
you can add this as the answer as it solved my problem.
– Divya Vikash
Dec 16 '15 at 10:48
you can add this as the answer as it solved my problem.
– Divya Vikash
Dec 16 '15 at 10:48
1
1
@VipulAsri please put your comment as answer as it solved the question. You would help other guys
– piotrek1543
Dec 16 '15 at 21:32
@VipulAsri please put your comment as answer as it solved the question. You would help other guys
– piotrek1543
Dec 16 '15 at 21:32
add a comment |
5 Answers
5
active
oldest
votes
use recyclerView.smoothScrollToPosition(position);
position is your index of last item inserted. This will move your the RecyclerView focus on the last element.
add a comment |
Use can add any of the two lines on your LinearLayoutManager object to scroll your recyclerview to the bottom ...
llm.setStackFromEnd(true);
OR
llm.setReverseLayout(true);
1
it populates the list from bottom. this was not something i was looking for. Vipul's answer solved my problem. BTW,thanks.
– Divya Vikash
Dec 16 '15 at 10:50
add a comment |
Use
recyclerView.smoothScrollToPosition(position)
adapter.notifyDataSetChanged();
where position is the index of last element
recyclerView.getAdapter().getItemCount()-1
use this to get last element.
This worked for me .
add a comment |
Make Sure This position is the position of the item which you want to view.
recyclerView.smoothScrollToPosition(position);
add a comment |
You can use app:stackFromEnd="true" in your recycler view XML code like:
<android.support.v7.widget.RecyclerView
android:id="@+id/message_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/message_input"
android:layout_alignParentTop="true"
app:stackFromEnd="true" />
add a comment |
protected by Nilesh Rathod Apr 23 '18 at 6:22
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
use recyclerView.smoothScrollToPosition(position);
position is your index of last item inserted. This will move your the RecyclerView focus on the last element.
add a comment |
use recyclerView.smoothScrollToPosition(position);
position is your index of last item inserted. This will move your the RecyclerView focus on the last element.
add a comment |
use recyclerView.smoothScrollToPosition(position);
position is your index of last item inserted. This will move your the RecyclerView focus on the last element.
use recyclerView.smoothScrollToPosition(position);
position is your index of last item inserted. This will move your the RecyclerView focus on the last element.
answered Dec 17 '15 at 5:28
Vipul AsriVipul Asri
5,75313258
5,75313258
add a comment |
add a comment |
Use can add any of the two lines on your LinearLayoutManager object to scroll your recyclerview to the bottom ...
llm.setStackFromEnd(true);
OR
llm.setReverseLayout(true);
1
it populates the list from bottom. this was not something i was looking for. Vipul's answer solved my problem. BTW,thanks.
– Divya Vikash
Dec 16 '15 at 10:50
add a comment |
Use can add any of the two lines on your LinearLayoutManager object to scroll your recyclerview to the bottom ...
llm.setStackFromEnd(true);
OR
llm.setReverseLayout(true);
1
it populates the list from bottom. this was not something i was looking for. Vipul's answer solved my problem. BTW,thanks.
– Divya Vikash
Dec 16 '15 at 10:50
add a comment |
Use can add any of the two lines on your LinearLayoutManager object to scroll your recyclerview to the bottom ...
llm.setStackFromEnd(true);
OR
llm.setReverseLayout(true);
Use can add any of the two lines on your LinearLayoutManager object to scroll your recyclerview to the bottom ...
llm.setStackFromEnd(true);
OR
llm.setReverseLayout(true);
answered Dec 16 '15 at 8:37
rd7773rd7773
1819
1819
1
it populates the list from bottom. this was not something i was looking for. Vipul's answer solved my problem. BTW,thanks.
– Divya Vikash
Dec 16 '15 at 10:50
add a comment |
1
it populates the list from bottom. this was not something i was looking for. Vipul's answer solved my problem. BTW,thanks.
– Divya Vikash
Dec 16 '15 at 10:50
1
1
it populates the list from bottom. this was not something i was looking for. Vipul's answer solved my problem. BTW,thanks.
– Divya Vikash
Dec 16 '15 at 10:50
it populates the list from bottom. this was not something i was looking for. Vipul's answer solved my problem. BTW,thanks.
– Divya Vikash
Dec 16 '15 at 10:50
add a comment |
Use
recyclerView.smoothScrollToPosition(position)
adapter.notifyDataSetChanged();
where position is the index of last element
recyclerView.getAdapter().getItemCount()-1
use this to get last element.
This worked for me .
add a comment |
Use
recyclerView.smoothScrollToPosition(position)
adapter.notifyDataSetChanged();
where position is the index of last element
recyclerView.getAdapter().getItemCount()-1
use this to get last element.
This worked for me .
add a comment |
Use
recyclerView.smoothScrollToPosition(position)
adapter.notifyDataSetChanged();
where position is the index of last element
recyclerView.getAdapter().getItemCount()-1
use this to get last element.
This worked for me .
Use
recyclerView.smoothScrollToPosition(position)
adapter.notifyDataSetChanged();
where position is the index of last element
recyclerView.getAdapter().getItemCount()-1
use this to get last element.
This worked for me .
answered Jul 17 '17 at 18:06
PriyankchoudharyPriyankchoudhary
10713
10713
add a comment |
add a comment |
Make Sure This position is the position of the item which you want to view.
recyclerView.smoothScrollToPosition(position);
add a comment |
Make Sure This position is the position of the item which you want to view.
recyclerView.smoothScrollToPosition(position);
add a comment |
Make Sure This position is the position of the item which you want to view.
recyclerView.smoothScrollToPosition(position);
Make Sure This position is the position of the item which you want to view.
recyclerView.smoothScrollToPosition(position);
edited Apr 23 '18 at 6:23
Nilesh Rathod
33.9k83461
33.9k83461
answered Mar 9 '17 at 12:59
Rahul GoswamiRahul Goswami
197
197
add a comment |
add a comment |
You can use app:stackFromEnd="true" in your recycler view XML code like:
<android.support.v7.widget.RecyclerView
android:id="@+id/message_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/message_input"
android:layout_alignParentTop="true"
app:stackFromEnd="true" />
add a comment |
You can use app:stackFromEnd="true" in your recycler view XML code like:
<android.support.v7.widget.RecyclerView
android:id="@+id/message_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/message_input"
android:layout_alignParentTop="true"
app:stackFromEnd="true" />
add a comment |
You can use app:stackFromEnd="true" in your recycler view XML code like:
<android.support.v7.widget.RecyclerView
android:id="@+id/message_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/message_input"
android:layout_alignParentTop="true"
app:stackFromEnd="true" />
You can use app:stackFromEnd="true" in your recycler view XML code like:
<android.support.v7.widget.RecyclerView
android:id="@+id/message_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/message_input"
android:layout_alignParentTop="true"
app:stackFromEnd="true" />
answered Mar 8 at 4:20
Pardeep SinghPardeep Singh
276
276
add a comment |
add a comment |
protected by Nilesh Rathod Apr 23 '18 at 6:22
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
2
use
recyclerView.smoothScrollToPosition(position);position is your index of last item inserted.– Vipul Asri
Dec 16 '15 at 8:38
you can add this as the answer as it solved my problem.
– Divya Vikash
Dec 16 '15 at 10:48
1
@VipulAsri please put your comment as answer as it solved the question. You would help other guys
– piotrek1543
Dec 16 '15 at 21:32