RecyclerView Orientation

0

How can I make for the recyclerview instead of filling from top to bottom starting 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 as the new messages are off screen it only appears scrolling the screen I need it to be the opposite the new messages stay on the foot wheel and the older ones are at the top of the 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);

            }
        }}
    
asked by anonymous 09.03.2017 / 19:23

2 answers

1

Friend, make the following changes to your RecyclerView, disregarding the first line of the block:

LinearLayoutManager layout_manager = new LinearLayoutManager(getContext());
layout_manager.setReverseLayout(true);
layout_manager.setStackFromEnd(true);
    
11.03.2017 / 14:51
0

Right now I understand, you want to show the end values

there is a method called

smoothScrollToPosition

then use lista.smoothScrollToPosition(int position)

It will start from the position you set

If it is the last one, just write the value of the position and pass the parameter

If you are using recycler view for example it will do so more or less

recyclerView.smoothscrolltoposition(lista.size());

Since the values during the insertion are the last, it will go straight to the end

I think that's what I meant

    
09.03.2017 / 19:33