寬高不確定的情況下,圖片下方的那段空白怎么去掉。<?xml?version="1.0"?encoding="utf-8"?>
<LinearLayout?xmlns:android="http://schemas.android.com/apk/res/android"
??????????????android:layout_width="match_parent"
??????????????android:layout_height="match_parent"
??????????????android:orientation="vertical">
????<ImageButton
????????android:id="@+id/imageButton"
????????android:layout_width="match_parent"
????????android:layout_height="wrap_content"
????????android:background="#00000000"
????????android:scaleType="fitStart"
????????android:src="@drawable/aaa5"
???????/>
????<TextView
????????android:layout_width="match_parent"
????????android:layout_height="wrap_content"
????????android:gravity="center"
????????android:text="123"
????????android:textSize="30sp"/>
</LinearLayout>
4 回答

小羅希冀
TA貢獻(xiàn)13條經(jīng)驗(yàn) 獲得超7個(gè)贊
你好,建議你把ImageButton中的scaleType屬性修改一下,你選擇的FIT_START的作用是填充于屏幕上方,并等比例縮放、你可以嘗試一下把屬性設(shè)置成center

慕仰6620973
TA貢獻(xiàn)14條經(jīng)驗(yàn) 獲得超8個(gè)贊
。。。自己整出來了用這個(gè)android:adjustViewBounds="true"就可以。。

weibo_土豆fighting_0
TA貢獻(xiàn)1條經(jīng)驗(yàn) 獲得超0個(gè)贊
設(shè)置 ImageButton的屬性 android:background = "@null"
- 4 回答
- 0 關(guān)注
- 1408 瀏覽
添加回答
舉報(bào)
0/150
提交
取消