2015-12-15 45 views
1

這是一個與低於5.0其他Android版本不同 演示代碼:在Android 5.0中,如果一個TextView已成立lineSpacingExtra,並且只有一個行文字,TextView的不顯示linespacing

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 
<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:lineSpacingExtra="100dp" 
    android:text="Hello World!"/> 

在Android 5.0,它表明: enter image description here

下面是Android 5.0,它表明: enter image description here

但是,如果textview有超過兩行,它們顯示相同! 我該如何才能讓它們在不同的操作系統版本上顯示相同? 幫助!

回答

1

你可以設置一個paddingBottom到視圖超過棒棒糖一樣

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:lineSpacingExtra="100dp" 
    android:text="Hello World!" 
    android:paddingBottom="@dimen/padding"/> 

,並在dimens(值-V19)設置padding=0dp並在dimens(值-V21)

+0

大集padding=100dp!這是訣竅,但有效! – leo

相關問題