Note that there are some explanatory texts on larger screens.

plurals
  1. POTextView marquee shifts adjacent TextView
    primarykey
    data
    text
    <p>I have <code>RelativeLayout</code> that consists of <code>TextView</code>s that I use to inflate items in a list. The layout is like this:</p> <p><img src="https://i.stack.imgur.com/FLiVH.png" alt="enter image description here"></p> <p>The larger title text is sometimes too long, so I set the <code>ellipsize</code> attribute on the <code>TextView</code> to marquee, which cuts it off as you can see in the picture. <strong>The problem is</strong> more subtle in the pic (from the emulator) but on a device you can see more clearly that that the <code>marquee</code> shifts the "Days Lent" label so they are not all aligned. Or rather, I believe the row with the marquee has the correct alignment, but the ones without the marquee get pulled further somehow.</p> <p>This only happens on the <code>marquee</code> setting and not on the regular ellipsis <code>end</code>, which makes me think it is something with the animation that the marquee does. I include my XML layout below so you can see how things work. Salient points from code: The title TV has padding to push it away from the right edge; "Days Lent" is positioned relative left of the 0 number; the title is <code>alignParentLeft</code>; and the 0 number is <code>aligneParentRight</code>.</p> <p>I've tried changing the padding on "Days Lent" and messing with the <code>marqueeRepeatLimit</code>, as well as just using a regular ellipsis.</p> <p>So: <strong>Why does this misalignment happen to the adjacent <code>TextView</code> when marquee is used?</strong></p> <p>Thanks.</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"&gt; &lt;TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="24sp" android:layout_alignParentLeft="true" android:paddingRight="70dp" android:paddingTop="3dp" android:paddingBottom="3dp" android:textColor="@color/green" android:ellipsize="marquee" android:singleLine="true" /&gt; &lt;TextView android:id="@+id/description" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="13sp" android:layout_below="@id/title" android:layout_alignParentLeft="true" android:paddingRight="70dp"/&gt; &lt;TextView android:id="@+id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="13sp" android:layout_below="@id/description" android:layout_alignParentLeft="true" android:paddingBottom="3dp"/&gt; &lt;TextView android:id="@+id/days" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="32sp" android:paddingRight="10dp" android:layout_alignParentRight="true" android:layout_centerVertical="true" /&gt; &lt;TextView android:id="@+id/label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="11sp" android:paddingRight="5dp" android:text="Days\nLent" android:layout_toLeftOf="@id/days" android:layout_centerVertical="true"/&gt; </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload