Okay I think I have solution to your problem:
First of all , in your RecyclerView's item layout , make the parent layout clickable and your TextView's visibility as gone:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_layout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:layout_gravity="center"
android:gravity="center"
>
<TextView
android:id="@+id/text_title"
android:layout_width="match_parent"
android:layout_height="50dp"/>
</LinearLayout>
Making your parent layout clickable is necessary, and declare this LinearLayout in your ViewHolder class as well like this:
class ViewHolder extends RecyclerView.ViewHolder {
private LinearLayout itemLayout;
private TextView textItem;
ViewHolder(final View itemView) {
super(itemView);
itemLayout=(LinearLayout) itemView.findViewById(R.id.movie_item);
textItem=(TextView)itemView.findViewById(R.id.text_title);
}
Then instead of itemView.setOnClickListener, use itemLayout.setOnClickListener()
as below:
itemlayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//make your textView or your items Visible
//make your textview clickable
//set Your itemLayoutClickable as false
}
});
Then finally, make onClickListener for your TextView:
textItem.setOnClickListener=new View.OnClickListener() {
@Override
public void onClick(View view) {
//perform your text click action
}
});
For making the TextView Invisible again, you might wanna add some extra logic, such as setting flag , checking flag and making the items visible or invisible and notifying the adapter