2012-10-14 42 views
1

在我的應用程序的佈局使用SDK內置16和我測試過,並證實他們做工精細的ICS和JB國標,但有以下問題:的Android TextView的文本僅在薑餅切斷

在下面的代碼,我只是試圖創建一個只有文本的簡單佈局。儘管第一行結尾處的薑餅文字仍然被切斷,而不是繼續下一行。我已經嘗試將singeLine設置爲false,用線,maxLines,選取框,layoutWeight,將layoutHeight和layoutWidth改爲每個可以想象的組合等等。這個問題真的讓我感到困惑。

代碼: -

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"> 

<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 

<TextView 
    android:id="@+id/textView7" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Text keeps overflowing" 
    android:textAppearance="?android:attr/textAppearanceMedium" 
    android:textColor="#33B5E5" 
    android:paddingTop="6dp" 
    /> 

<TextView 
    android:id="@+id/textView8" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Text gets cut off when I input a long string like this one" 
    android:textAppearance="?android:attr/textAppearanceMedium" 
    android:textColor="#FFFFFF" 
    /> 

</LinearLayout> 

</ScrollView> 

另外,如果我改變佈局,以薑餅的主題,我得到的錯誤:

Failed to find style 'scrollViewStyle' in current theme 
Failed to find style 'textViewStyle' in current theme 
android.content.res.Resources$NotFoundException 

在此先感謝。

回答

2

我自己修復了。無法找出爲什麼發生,但我通過添加以下線路爲TextViews代碼固定它: -

+0

出於興趣,如果你把一個長串到你仍然得到這個問題的' setText(CharSequence)'方法?我有看起來像是相同的問題,但只有從資源字符串填充時。 http://stackoverflow.com/questions/13879505/textview-only-displaying-the-first-four-lines-of-a-resource-string –

+1

啊......不幸的是,這種解決方案並沒有爲我工作(雖然我AM在薑餅)所以我想它一定是別的東西。 –