0
如何在收到新数据时保持RecyclerView中“滚动条”的位置?例如,Whatsapp?Android如何初始化活动RecyclerView Scrollbars INVERTED to BOTTOM?
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerViewchatView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:scrollbars="vertical"
android:layout_above="@+id/botaoenviar"/>
protected void onCreate(Bundle savedInstanceState) {...
recyclerView.smoothScrollToPosition(recyclerView.getAdapter().getItemCount() -1);
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
getDataUsuarioDestino();
//adapter.notifyDataSetChanged();
handler.postDelayed(this, 3000);
}
}, 3000);