0

アプリケーションのアクション バーに ImageButton があり、タイトルを選択してビューを変更するためのスピナーをシミュレートするために使用します (開始点として MonoDroid.ActionBar を使用しています - http://bit.ly/UBzI77 )。

ImageButton-Before

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-After

ImageButton の背景を透明にする方法を知っている人はいますか?

前もって感謝します。

4

1 に答える 1

2

null の背景と組み合わせて、次のことを試してください。

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"
于 2012-11-14T00:59:40.530 に答える