0

제목 (MonoDroid.ActionBar을 시작점으로 사용 - http://bit.ly/UBzI77)을 선택하여보기를 변경하는 스피너를 시뮬레이트하는 데 사용하는 응용 프로그램의 Action Bar에 ImageButton이 있습니다.ImageButton 배경이 숨겨져있을 때 아이콘 정렬 변경을 방지하려면 어떻게해야합니까?

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 배경을 투명하게하는 방법을 알고 있지만하여 ImageButton의 하단에 정렬 된 아이콘을 유지합니까?

미리 감사드립니다.

+0

을 시도 할 수 있을까? 뭔가 :'android : scaleType = "matrix"'. 옵션은 MATRIX, FIT_START, FIT_END 등입니다. [출처] (http://developer.android.com/reference/android/widget/ImageView.ScaleType.html) – jnthnjns

답변

2

는 null을 배경으로 조합에 다음을 시도해보십시오 scaleType` :

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" 
+0

Xono - 귀하의 안드로이드 : layout_height/android : 중력 제안이 효과가있었습니다. 감사! – billmaya

+0

Xono - android : layout_alignParentBottom/android : layout_marginBottom 조합은 ImageButton의 하단에 아이콘을 배치하지만 marginBottom을 설정 한 것과 관계없이 아이콘의 초기 위치에서 이동하지 않습니다. – billmaya

+0

정말요? 그것은 효과가 있었음에 틀림 없습니다 - 사실 저는 일하기를 기대하는 것과 같았습니다. RelativeLayout의 alignParent와 여백이 잘 어울리지 않는 것 같습니다. marginBottom을'android : paddingBottom = "3dp"'로 대체 해보십시오. 더 잘 작동하는지 확인하십시오. – Xono

관련 문제