簡體   English   中英

TextView中的部分字出屏!

[英]Parts of words in TextView are out of the screen!

哎,我有個問題,TextView里面的文字部分出屏了,看圖:在此處輸入圖像描述

我用紅色方塊標記了問題.. 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>

有可能修復嗎? 有什么解決辦法嗎? 謝謝。

你應該使用 17sp 而不是 17px 作為你的 textSize。 sp 代表 Scaled Pixel,它將使您的應用程序在具有不同屏幕尺寸和密度的各種設備上看起來更好/更一致。

至於你遇到的問題。 如果您將 TextViews layout_width 屬性設置為某個值,例如android:layout_width="200dip"在我看來,您的 TextView 認為它比實際使用的空間更多(可能與灰色框有關輸入你為背景設置的東西,但這是一個純粹的猜測)如果你將它設置為某個特定值並且它開始在下一行正確地換行文本。 然后你只需要嘗試幾種不同的寬度,然后找出你能把它做得多大來保持一切看起來應該的樣子。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM