0
How can I make to recyclerview instead of filling from top to bottom start from bottom to top.
EDITED
when I open my activity with recyclerview and it has several messages so that it exceeds the size of the screen the newer messages stay off the screen only appears scrolling the screen I need it to be contrary the new messages stay on the wheel and the older ones stay on top screen..
@Override
protected void onStart () {
super.onStart();
FirebaseRecyclerAdapter<Chat, ChatViewHolder> firebaseRecycleAdapter = new FirebaseRecyclerAdapter<Chat, ChatViewHolder>(
Chat.class,
R.layout.chat_row,
ChatViewHolder.class,
mDatabase
) {
final String user_id = mAuth.getCurrentUser().getUid();
@Override
protected void populateViewHolder(ChatViewHolder viewHolder, Chat model, int position) {
final String post_key = getRef(position).getKey();
viewHolder.setName(model.getName());
viewHolder.setComentario(model.getComentario());
viewHolder.setFtperfil(getApplicationContext(), model.getFtperfil());
viewHolder.setData(model.getData());
viewHolder.mView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//Toast.makeText(MainActivity.this, post_key , Toast.LENGTH_LONG).show();
Intent singleBlogIntent = new Intent(ActivityChat.this, ID_usuario_perfil.class);
singleBlogIntent.putExtra("blog_id", post_key);
startActivity(singleBlogIntent);
}
});
}};
}
});
mChatlist.setAdapter(firebaseRecycleAdapter);
}
public static class ChatViewHolder extends RecyclerView.ViewHolder {
View mView;
ImageButton mLikebtn;
DatabaseReference mDatabaseLike;
FirebaseAuth mAuth;
public ChatViewHolder(View itemView) {
super(itemView);
mView = itemView;
mLikebtn = (ImageButton) mView.findViewById(R.id.like_Btn);
mDatabaseLike = FirebaseDatabase.getInstance().getReference().child("Like");
mAuth = FirebaseAuth.getInstance();
mDatabaseLike.keepSynced(true);
}
public void setName (String username) {
RobotoTextView post_username = (RobotoTextView) mView.findViewById(R.id.nameChat);
post_username.setText(username);
}
public void setComentario (String comentario) {
TextView post_username = (TextView) mView.findViewById(R.id.messageChat);
post_username.setText(comentario);
}
public void setData (String comentario) {
TextView post_data = (TextView) mView.findViewById(R.id.dataChat);
post_data.setText(comentario);
}
public void setFtperfil(Context ctx, String ftperfil) {
CircleImageView post_perfil = (CircleImageView) mView.findViewById(R.id.imageChat);
Picasso.with(ctx).load(ftperfil).into(post_perfil);
}
}}
Suddenly if you change the sort of the list you can solve instead of changing the sort of Recyclerview
– GabrielLocalhost
Change the ordering of the list as @Gabriellocalhost said is the best solution.
– Rui Cardoso
Good as I can do?
– Wallace Roberto