title: How to get all RecyclerView ViewHolder?
body: <p>I want to change all items' text color when I click on one of them. My problem is that the color is changing only on visible items. The color of invisible items does not change at all. </p>
  
  <p><strong>New:</strong>
  Also I would like to know how to change the color of the clicked item only.</p>
  
  <p>EffectPanelRecyclerViewAdapter.java:</p>
  
  <pre><code>public class EffectPanelRecyclerViewAdapter extends RecyclerView.Adapter&lt;EffectPanelRecyclerViewAdapter.ViewHolder&gt; {
  private ArrayList&lt;String&gt; mDataset = null;
  private MyItemClickListener mItemClickListener;
  
  public EffectPanelRecyclerViewAdapter(ArrayList&lt;String&gt; datats) {
      mDataset = datats;
  }
  
  
  public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
      public TextView mTextView;
      private MyItemClickListener mListener;
  
      public ViewHolder(View v, MyItemClickListener listener) {
          super(v);
          mListener = listener;
          mTextView = (TextView) v.findViewById(R.id.tv);
          v.setOnClickListener(this);
      }
  
      @Override
      public void onClick(View v) {
          if (mListener != null) {
              Log.d("hello", "getAdapterPosition=" + getAdapterPosition());
              mListener.onItemClick(v, getAdapterPosition());
          }
      }
  
  }
  
  @Override
  public int getItemCount() {
      return mDataset.size();
  }
  
  public interface MyItemClickListener {
      public void onItemClick(View view, int postion);
  }
  
  /**
   * ViewHolder
   */
  @Override
  public EffectPanelRecyclerViewAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
      // create a new view
      View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item, parent, false);
      // set the view's size, margins, paddings and layout parameters
      ViewHolder vh = new ViewHolder(v, mItemClickListener);
      Log.d("hello", "onCreateViewHolder");
      return vh;
  }
  
  @Override
  public void onBindViewHolder(ViewHolder holder, final int position) {
      Log.d("hello", "onBindViewHolder,position=" + position);
      ViewHolder mHolder = (ViewHolder) holder;
      mHolder.mTextView.setText(mDataset.get(position));
      mHolder.mTextView.setTag(position);
      mHolder.mTextView.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              mItemClickListener.onItemClick(v, position);
          }
      });
  }
  
  public void setOnItemClickListener(MyItemClickListener listener) {
      this.mItemClickListener = listener;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>MainActivity.java:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  private ArrayList&lt;String&gt; mDatas;
  private RecyclerView mRecyclerView;
  private EffectPanelRecyclerViewAdapter mAdapter;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      initDatas();
      mRecyclerView = (RecyclerView) findViewById(R.id.id_recyclerview_horizontal);
      final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
      linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
      mRecyclerView.setLayoutManager(linearLayoutManager);
      mAdapter = new EffectPanelRecyclerViewAdapter(mDatas);
      mRecyclerView.setAdapter(mAdapter);
      mAdapter.setOnItemClickListener(new EffectPanelRecyclerViewAdapter.MyItemClickListener() {
          @Override
          public void onItemClick(View view, int position) {
              Toast.makeText(MainActivity.this, "position=" + position, Toast.LENGTH_SHORT).show();
              //I want to change all item text color.How to do it ?
              for (int i = 0; i &lt; mAdapter.getItemCount(); i++) {
                  EffectPanelRecyclerViewAdapter.ViewHolder viewHolder = (EffectPanelRecyclerViewAdapter.ViewHolder) mRecyclerView.findViewHolderForAdapterPosition(i);
                  if (viewHolder != null) {
                      viewHolder.mTextView.setTextColor(Color.RED);
                      Log.d("hellotom", "if i=" + i);
                  } else {
                      Log.d("hellotom", "else i=" + i);
                  }
              }
          }
      });
  }
  
  private void initDatas() {
      mDatas = new ArrayList();
      for (int i = 0; i &lt; 10; i++) {
          mDatas.add(i, "i=" + i);
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>activity_main.xml:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;android.support.v7.widget.RecyclerView
      android:id="@+id/id_recyclerview_horizontal"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_centerVertical="true"
      android:paddingBottom="18dp"
      android:paddingTop="15dp"
      android:scrollbars="none" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>item.xml:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"&gt;
  
  &lt;TextView
      android:id="@+id/tv"
      android:layout_width="100dp"
      android:layout_height="100dp"
      android:drawableTop="@drawable/ic_launcher_select"
      android:textColor="@color/select_color"
      android:gravity="center"
      android:text="@string/app_name" /&gt;
  </code></pre>
  
  <p></p>