我的应用程序操作栏中有一个ImageButton,我用它来模拟一个微调器,通过选择标题来改变视图(我使用MonoDroid.ActionBar作为起点 - http://bit.ly/UBzI77)。
这是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的底部?
提前致谢。
答案 0 :(得分:2)
结合空背景尝试以下内容:
android:layout_alignParentBottom="true"
android:layout_marginBottom="3dp" // this is here just to ensure the image doesn't sit flush against the bottom of the bar, vary as required
或者,您可以尝试
android:layout_height="match_parent"
android:gravity="bottom"