title: Automatically scrolling TextView inside a ViewPager
body: <p>I want to create a <code>LinearLayout</code> with two <code>TextView</code>s: a label and a data placeholder. Since the data can be arbitrarily long, I want to restrict the size of the second <code>TextView</code> to a single line, and to automatically scroll horizontally if the data does not fit in the view.</p>
  
  <p>Also, I want the width of the second <code>TextView</code> to be calculated at runtime, so that it can fill 70% of the parent container and be aligned to its right.</p>
  
  <p>So far this is what I've got:</p>
  
  <pre><code>&lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      android:id="@+id/ll_denunciante" &gt;
  
      &lt;TextView
          android:id="@+id/txtv_label_denunciante"
          android:layout_width="0px"
          android:layout_height="wrap_content"
          android:layout_weight="0.3"
          android:gravity="left"
          android:text="@string/txtv_label_denunciante" /&gt;
      &lt;TextView
          android:id="@+id/txtv_data_denunciante"
          android:layout_width="0px"
          android:layout_height="wrap_content"
          android:layout_weight="0.7"
          android:gravity="right"
          android:maxLines="1"
          android:ellipsize="marquee"
          android:scrollHorizontally="true"
          android:marqueeRepeatLimit="marquee_forever"
          android:text="@string/txtv_no_data" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>But the text is simply cut off. It is not ellipsized and automatic scrolling does not work.
  Adding</p>
  
  <pre><code>android:focusable="true"
  android:focusableInTouchMode="true"
  </code></pre>
  
  <p>does not fix the problem.</p>
  
  <p>The answer to <a href="https://stackoverflow.com/questions/18123127/automatic-horizontal-scroll-in-textview-with-layout-weight">this</a> question did not help either.</p>
  
  <p>I'll gladly accept an answer using a <code>RelativeLayout</code> if it accomplishes the desired result using less code or if it is not possible using a <code>LinearLayout</code>.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Changing the second <code>TextView</code> to:</p>
  
  <pre><code>&lt;TextView
       android:id="@+id/txtv_data_denunciante"
       android:layout_width="0px"
       android:layout_height="wrap_content"
       android:layout_weight="0.7"
       android:ellipsize="marquee"
       android:gravity="right"
       android:marqueeRepeatLimit="marquee_forever"
       android:singleLine="true"
       android:text="@string/txtv_no_data" /&gt;
  </code></pre>
  
  <p>and adding </p>
  
  <pre><code>txtvDataDenunciante.setSelected(true);
  </code></pre>
  
  <p>fixed it.</p>