今天在做安卓表格的時候使用了HorizontalScrollView煤裙,發(fā)現(xiàn)使用后表格不能鋪滿整個屏幕并且還有文字顯示不全的問題如圖:
![B(}UPXFB)3E4H%8H}02YRN.png
從網(wǎng)上找了很多辦法艘策,有人說需要在代碼中動態(tài)添加Linearlayout阿纤,我覺得那樣太麻煩了雾叭,還有人說是因為權(quán)重的問題,但是如果不適用全中的話根本達不到效果竞慢,所以最終找到一個兩全其美的辦法就是在HorizontalScrollView屬性添加android:fillViewport="true"
R9~{2D%@YAK)CK[`]C9(XRY.png
布局如下:
<HorizontalScrollView
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
</HorizontalScrollView>