2014-07-19 1 views
0

작업 레이아웃을 호출하여 사용자 정의 메뉴 항목을 개발 중이지만 해당 작업 메뉴에 색을 눌러 총 위쪽 높이와 아래쪽 여백을주는 높이가 적용되지 않습니다. 문제의안드로이드 장치의 사용자 정의 작업 아이콘

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"  
    android:gravity="center"> 

    <ImageView 
     android:minWidth="56dp" 
     android:id="@+id/voicemailNotificationCounter" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:scaleType="center" 
     android:clickable="true" 
     android:background="@drawable/ab_pressedicon_bgcolor" 
     android:contentDescription="@string/voicemailnotification" 
     android:src="@drawable/ab_voicemail"> 
    </ImageView> 

    <TextView android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/vmNotificationTextCounter" 
     android:text="1" 
     android:visibility="visible" 
     android:layout_alignRight="@+id/voicemailNotificationCounter" 
     android:layout_marginRight="10dp" 
     android:gravity="center" 
     android:textColor="#fff" 
     android:includeFontPadding="false" 
     android:background="@drawable/notification_alertbg" 
     android:textSize="12sp"/> 

</RelativeLayout> 
+0

아이콘이 9 패치입니까? –

+0

아니요 9 패치 이미지가 아닙니다. 정상적인 작업 표시 줄 아이콘입니다. – Rayani

답변

0

일부는 당신이하여 ImageButton을 사용하지 않을 것입니다 :

다음은 내 코드입니다.

이미지와 텍스트를 is possible과 ImageButton으로 결합합니다. 해당 ImageButton 내부의 텍스트와 이미지를 독립적으로 조정할 수도 있습니다.

ImageButton이 작업 메뉴에서 작동하기를 바랍니다. 실제로 그 부분을 아직 테스트하지 않았습니다.

+0

스테판 감사합니다 ... !!! – Rayani

+0

@ Rayani, 그런데, 당신에게 가장 유용한 대답을 찾으면 그것을 받아들이는 것도 좋은 방법입니다. 감사합니다. 참조 : http://meta.stackexchange.com/a/5235/151788 또한 9- 패치 사용이 액션 메뉴에서 일반적으로 사용되지 않는다고하더라도이 패치 사용을 할인하지 마십시오. match_parent와 함께 9 패치를 사용하고 기존 코드 내에서 일부 미세 조정을하면 ImageButton이 필요하지 않은 것처럼 잘 작동했을 것입니다. –

관련 문제