我在我的應用程序的Action Bar中有一個ImageButton,用於通過選擇標題(我使用MonoDroid.ActionBar作爲起點 - http://bit.ly/UBzI77)來模擬更改視圖的微調控制器。隱藏ImageButton背景時,如何防止圖標對齊更改?
下面是對的ImageButton的XML。
<ImageButton
android:id="@+id/title_spinner_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/actionbar_title"/>
當我通過向XML添加android:background屬性來使ImageButton背景透明時。
<ImageButton
android:id="@+id/title_spinner_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/actionbar_title"
android:background="@null"/>
ImageButton背景消失,但圖標垂直居中。
有誰知道如何使ImageButton的背景透明的,但保持在ImageButton的底部排列圖標?
在此先感謝。
你用'機器人出場:scaleType'?例如:'android:scaleType =「matrix」'。選項是MATRIX,FIT_START,FIT_END等。[來源](http://developer.android.com/reference/android/widget/ImageView.ScaleType.html) – jnthnjns