2011-05-02 14 views
2

嘿,我有一个问题,即在TextView的文本的部分是在屏幕之外,看图片: enter image description hereTextView中部分单词不在屏幕上!

我标记为红色方块的问题.. XML:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_gravity="right" 
    android:background="@drawable/list" 
    android:padding="15px"> 

    <ScrollView android:id="@+id/ScrollView01" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 
<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:gravity="right"> 

<TextView 
android:id="@+id/TfseerTextView" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:textSize="17px" 
android:textColor="#000" 
     ></TextView> 
     </LinearLayout> 
     </ScrollView> 

</LinearLayout> 

可以修复吗?有什么解决办法吗?谢谢。

回答

0

您应该使用17sp而不是17px来表示textSize。 sp代表Scaled Pixel,它会让您的应用在各种屏幕尺寸和密度不同的设备上显示更好/更一致。

至于你遇到的问题。如果您将TextViews layout_width属性设置为某个值,例如是否有任何区别android:layout_width="200dip"它看起来像我的像你的TextView认为它有更多的空间来使用,然后它实际上(可能与灰色框类型的东西,你有背景,但这是一个纯粹的猜测)如果你把它设置为一些特定值,它开始在下一行正确包装文本。然后,你只需要尝试几个不同的宽度,并找出你可以做到多大,让所有东西看起来像它应该。

+0

它是同样的事情..即使我将layout_width设置为200dip或任何其他值,仍然有一些字符不显示:( – Omar 2011-05-03 08:45:02