Parts of words in TextView are out of the screen!
Hey, I have a problem where parts of the Text in the TextView are out of the screen, Look at the picture:
I marked the problem in red squares.. xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="开发者_JAVA技巧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>
Is it possible to fix? Is there any work around? Thanks.
you should use 17sp instead of 17px for your textSize. sp stands for Scaled Pixel, it will result in your app appearing better / more consistent across a wide variety of devices with differing screen sizes and densities.
As for the problem you are having. Does it make any difference if you set the TextViews layout_width attribute to some value e.g. android:layout_width="200dip"
It looks to me like your TextView thinks that it has more space to use then it actually does (could be related to the grey box type things you have for the background, but this is a pure guess) If you set it to some specific value and it starts to wrap the text properly on the next line. Then you just have to try a few different widths and find out how big you can make it to keep everything appearing like it should.
精彩评论