title: Android RecyclerView with LinearLayout
body: <p>I have been reading about Google's Material Design and ran across the new RecyclerView for Android. I have been following Google's tutorial but their example is very slim and I want to do more dynamic things with my RecylerView and I was hoping someone could help explain how to do so.</p>
  
  <p>This is Google's RecyclerView Adapter Example</p>
  
  <pre><code>public class MyAdapter extends RecyclerView.Adapter&lt;MyAdapter.ViewHolder&gt; {
      private String[] mDataset;
  
      // Provide a reference to the views for each data item
      // Complex data items may need more than one view per item, and
      // you provide access to all the views for a data item in a view holder
      public static class ViewHolder extends RecyclerView.ViewHolder {
          // each data item is just a string in this case
          public TextView mTextView;
          public ViewHolder(TextView v) {
              super(v);
              mTextView = v;
          }
      }
  
      // Provide a suitable constructor (depends on the kind of dataset)
      public MyAdapter(String[] myDataset) {
          mDataset = myDataset;
      }
  
      // Create new views (invoked by the layout manager)
      @Override
      public MyAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
                                                     int viewType) {
          // create a new view
          View v = LayoutInflater.from(parent.getContext())
                                 .inflate(R.layout.my_text_view, parent, false);
          // set the view's size, margins, paddings and layout parameters
          ...
          ViewHolder vh = new ViewHolder((TextView)v);
          return vh;
      }
  
      // Replace the contents of a view (invoked by the layout manager)
      @Override
      public void onBindViewHolder(ViewHolder holder, int position) {
          // - get element from your dataset at this position
          // - replace the contents of the view with that element
          holder.mTextView.setText(mDataset[position]);
  
      }
  
      // Return the size of your dataset (invoked by the layout manager)
      @Override
      public int getItemCount() {
          return mDataset.length;
      }
  }
  </code></pre>
  
  <p>I've implemented this into my Android app and it successfully worked but the Layout they use only contains a single TextView. </p>
  
  <p>Can someone explain how I can use this example for a layout that has multiple textviews? </p>
  
  <p>For example:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="horizontal"
      android:layout_width="match_parent"
      android:layout_height="?attr/listPreferredItemHeight"
      android:gravity="center_vertical"
      android:paddingLeft="8dp"
      android:paddingRight="8dp"&gt;
  
      &lt;TextView
          android:id="@+id/title"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:layout_margin="8dp"/&gt;
  
      &lt;TextView
          android:id="@+id/text"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:layout_margin="8dp"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>How can I access the TextView's separately and possibly change the attributes for the LinearLayout?</p>
  
  <p>This is where I have been following the Google tutorial <a href="https://developer.android.com/training/material/lists-cards.html" rel="nofollow">Google RecyclerView</a></p>