Developing an application in which there is a recyclerview with some cardsviews. On each card there are some images,textviews and relative layout that I would like to apply a facebook-like effect when touched.
- When you touch the screen, the card will expand, and the others will stay side by side at their original size.
- When you take your finger off the screen, the card will return to its original size.
What I have so far:
//rv
recyclerView = view.findViewById(R.id.recyclerView)
recyclerView.setHasFixedSize(false)
//layoutManager = LinearLayoutManager(activity)
recyclerView.layoutManager = LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false)
Adapter:
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> {
Context context;
List<Content> lista;
public MyAdapter(Context context, List<Content> lista) {
this.context = context;
this.lista = lista;
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int position) {
Content content = lista.get(position);
if (!content.getTitulo().isEmpty()) {
myViewHolder.titulo.setText(content.getTitulo);
}
if (!noticia.getThumb().isEmpty()) {
Glide.with(context).load(content.getThumb()).into(myViewHolder.imageThumb);
}
if (!content.getIcone().isEmpty()) {
Glide.with(context).load(content.getIcone()).into(myViewHolder.icone);
}
if (!content.getDescricao().isEmpty()) {
myViewHolder.textDescricao.setText(content.getDescricao());
}
if (!content.getData().isEmpty()) {
myViewHolder.data.setText(content.getData());
}
if (!content.getUrl().isEmpty()) {
myViewHolder.url = content.getUrl();
}
if (!content.getNomeSite().isEmpty()) {
myViewHolder.nomeSite.setText(content.getNomeSite());
}
myViewHolder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
Toast.makeText(context,"OnLongClick",Toast.LENGTH_SHORT).show();
return false;
}
});
}
How can I make this effect?