Android的TextView的斜体和wrap_contents [英] Android Textview Italic and wrap_contents

查看:198
本文介绍了Android的TextView的斜体和wrap_contents的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用3斜体textviews不同颜色

I am using 3 italic textviews with different colors

<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

I wonder every last character is not displaying properly specially name displayed in the middle is "Dan Buckland" and it it is missing last character looks like "Dan Bucklano"

还告诉我PLS怎么会有TextView的斜体和大胆的两个..

Also tell me pls how can have textview italic and bold both..

推荐答案

好像使用斜体时,边界框计算不正确。

Seems like the bounding box is not correctly calculated when using italic.

你有没有尝试过使用以下属性来= 6和paddingRight = 6的元素呢? (少重叠的几率)。

Have you tried to use paddingLeft=6 and paddingRight=6 for the elements? (less chance of overlap).

有关多种风格的一个TextView看到<一href="http://stackoverflow.com/questions/1529068/android-is-it-possible-to-have-multiple-styles-inside-a-textview">http://stackoverflow.com/questions/1529068/android-is-it-possible-to-have-multiple-styles-inside-a-textview

For multiple styles in a TextView see http://stackoverflow.com/questions/1529068/android-is-it-possible-to-have-multiple-styles-inside-a-textview

这篇关于Android的TextView的斜体和wrap_contents的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆