アンドロイドのTextView斜体とwrap_contents
-
20-09-2019 - |
質問
私は色違いで3イタリックtextviewsを使用しています。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="horizontal" android:id="@+id/submittedBy" android:paddingTop="10dip">
<ImageView android:id="@+id/subByImg"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:gravity="left" android:layout_gravity="bottom" android:src="@drawable/submitted_by_arrow"/>
<TextView android:id="@+id/submitLabel"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:gravity="left" android:text="Submitted by" android:textStyle="italic"
android:textSize="12sp" android:textColor="@color/gray" android:paddingLeft="5dip"/>
<TextView android:id="@+id/submitName" android:textStyle="italic"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textSize="12sp" android:textColor="@color/maroon_dark" android:paddingLeft="10dip"/>
<TextView android:id="@+id/submitByDate" android:textStyle="italic"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:gravity="left"
android:textSize="12sp" android:textColor="@color/gray" android:paddingLeft="10dip"/>
</LinearLayout>
私はすべての最後の文字が中央に表示された特別な名前は「ダン・バックランド」であり、それが最後の文字が「ダンBucklano」
のように見える不足している正しく表示されないだろうまた、両方..
のTextViewイタリックとボールドを持つことができますどのようにplsは私に言いますALTテキストhttp://www.freeimagehosting.net/uploads/953d573113.jpg の
解決
イタリック体を使用している場合、境界ボックスが正しく計算されないように、
に思えます。
あなたは要素のためpaddingLeft = 6とpaddingRight = 6を使用しようとしたことがありますか? (重複の少ないチャンス)。
のTextViewで複数のスタイルを参照してくださいそれはTextViewの内側に複数のスタイルを持っていることは可能ですか?の
他のヒント
私は正確に同じ問題を抱えていました。私は単にイタリック体であることが必要である任意の文字列の末尾にスペースを追加することによって、その周りました。
これは、最も長期的-正しい解決策ではないかもしれないが、それは私のために働いています。
あなたはstring.xmlをファイル内のテキストを 
を使用することができます。
所属していません StackOverflow