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













12















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.










share|improve this question

















  • 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















12















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.










share|improve this question

















  • 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













12












12








12


1






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.










share|improve this question














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.







android android-layout android-recyclerview






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 16 '15 at 8:23









Divya VikashDivya Vikash

4361623




4361623







  • 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












  • 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







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












5 Answers
5






active

oldest

votes


















26














use recyclerView.smoothScrollToPosition(position);



position is your index of last item inserted. This will move your the RecyclerView focus on the last element.






share|improve this answer






























    8














    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);





    share|improve this answer


















    • 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


















    4














    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 .






    share|improve this answer






























      1














      Make Sure This position is the position of the item which you want to view.



      recyclerView.smoothScrollToPosition(position);





      share|improve this answer
































        0














        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" />





        share|improve this answer





















          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









          26














          use recyclerView.smoothScrollToPosition(position);



          position is your index of last item inserted. This will move your the RecyclerView focus on the last element.






          share|improve this answer



























            26














            use recyclerView.smoothScrollToPosition(position);



            position is your index of last item inserted. This will move your the RecyclerView focus on the last element.






            share|improve this answer

























              26












              26








              26







              use recyclerView.smoothScrollToPosition(position);



              position is your index of last item inserted. This will move your the RecyclerView focus on the last element.






              share|improve this answer













              use recyclerView.smoothScrollToPosition(position);



              position is your index of last item inserted. This will move your the RecyclerView focus on the last element.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Dec 17 '15 at 5:28









              Vipul AsriVipul Asri

              5,75313258




              5,75313258























                  8














                  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);





                  share|improve this answer


















                  • 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















                  8














                  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);





                  share|improve this answer


















                  • 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













                  8












                  8








                  8







                  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);





                  share|improve this answer













                  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);






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  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












                  • 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











                  4














                  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 .






                  share|improve this answer



























                    4














                    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 .






                    share|improve this answer

























                      4












                      4








                      4







                      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 .






                      share|improve this answer













                      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 .







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jul 17 '17 at 18:06









                      PriyankchoudharyPriyankchoudhary

                      10713




                      10713





















                          1














                          Make Sure This position is the position of the item which you want to view.



                          recyclerView.smoothScrollToPosition(position);





                          share|improve this answer





























                            1














                            Make Sure This position is the position of the item which you want to view.



                            recyclerView.smoothScrollToPosition(position);





                            share|improve this answer



























                              1












                              1








                              1







                              Make Sure This position is the position of the item which you want to view.



                              recyclerView.smoothScrollToPosition(position);





                              share|improve this answer















                              Make Sure This position is the position of the item which you want to view.



                              recyclerView.smoothScrollToPosition(position);






                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              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





















                                  0














                                  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" />





                                  share|improve this answer



























                                    0














                                    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" />





                                    share|improve this answer

























                                      0












                                      0








                                      0







                                      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" />





                                      share|improve this answer













                                      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" />






                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Mar 8 at 4:20









                                      Pardeep SinghPardeep Singh

                                      276




                                      276















                                          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?



                                          Popular posts from this blog

                                          How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

                                          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

                                          List of MPs elected to the English parliament in 1640 (April) Contents List of constituencies and members See also Notes References Navigation menueNational Archives – The Glynde Place ArchivesCobbett's Parliamentary history of England, from the Norman Conquest in 1066 to the year 1803'Aldermen in Parliament', The Aldermen of the City of London: Temp. Henry III – 1912onepage&q&f&#61, false 229