2012-03-14 12 views
1

RelativeLayoutTextViewで構成されていますが、これはリスト内の項目を拡張するために使用します。隣接するTextViewマーキーが移動します

enter image description here

大きなタイトルテキストは、ときどき長すぎるので、私はあなたが写真で見ることができるように、それをカットされ、マーキーするTextViewellipsize属性を設定します。レイアウトは、このようなものです。 問題はです(エミュレータから)写真では微妙ですが、デバイス上では、marqueeが「Days Lent」ラベルをシフトして、すべてが整列していないことがより明確に分かります。または、マーキーの行が正しい配置になっていると思われますが、マーキーのないものは何らかの形でさらに引き出されます。

これはmarqueeの設定でのみ発生し、通常の省略記号endでは発生しません。これは、マーキーが行うアニメーションとは何かを考えています。私は物事の仕組みを見ることができるように私のXMLレイアウトを以下に示します。コードからの顕著な点:タイトルのTVは、右端からそれを押し出すためのパディングがあります。 「Days Lent」は、0の左から相対的に配置されます。タイトルはalignParentLeftです。 0の数字はaligneParentRightです。

私は "Days Lent"のパディングを変更し、marqueeRepeatLimitで混乱させるようにしました。通常の省略記号を使用しています。

So:マーキー使用時に隣接するTextViewにこのずれが発生するのはなぜですか?

ありがとうございました。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"> 
<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" /> 
<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"/> 
<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"/> 

<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" 
    /> 
<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"/> 

答えて

0

まあこれは、各タイトルは、すべての方法の行全体に伸ばした後、右側にパディングを持っていたように、私はちょうどタイトルfill_parentの代わりwrap_content作ら...馬鹿でした。それで、それらはすべて本質的に同じ長さのビューになり、アラインメントの問題が修正されました。

関連する問題