2012-03-14 6 views
2

android ImageButton에 문제가 있습니다. 내 아이콘이 상단에서 잘립니다.Android ImageButton이 아이콘을 자릅니다.

코드는 다음입니다 : 내가 알아 봤했지만 그들 중 누구도 도움이되지 몇 가지 해킹을 시도했습니다

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:gravity="center" 
    android:orientation="horizontal" 
    android:layout_marginBottom="20sp" 
    android:paddingLeft="20sp" 
    android:paddingRight="20sp" > 

    <TextView 
     android:id="@+id/registration_1_button_sex_male_title" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/registration_1_male" 
     android:textColor="#fff" 
     android:textSize="15sp" 
     android:typeface="monospace" /> 

    <ImageButton 
     android:id="@+id/registration_1_button_sex_male" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="@android:color/transparent" 
     android:paddingRight="20sp" 
     android:src="@drawable/icon_male_blue" /> 
</LinearLayout> 

.

+0

LinearLayout 및 ImageButton 안에 패딩을 추가하여 도움을주지 못했지만 아이콘 및 LinearLayout에 고정 된 높이를 부여하려했지만 그 중 아무 것도 작동하지 않았습니다. – kjurkovic

+0

이미지를 게시 할 수 있습니까 ?? – Tony

답변

0

를 추가해보십시오 :

android:scaleType="fitCenter" 

당신하여 ImageButton에

+0

ScaleType을 사용하여 모든 옵션을 시도했습니다. 여전히 동일한 문제가 발생했습니다. – kjurkovic

+0

아이콘 이동을 시도해 보셨습니까? drawable-hdpi/ldpi에서 이상한 동작을 발견하고 "drawable"폴더를 만드는 것으로 되돌 렸습니다. – Tony

+0

나는 그것을 움직이려고 노력했다. .. 그것은 아직도 동일하게 남아있다 : ​​\ – kjurkovic

1

안드로이드에 대한 이미지를 유지하려고 ScaleType 속성에 따라 다른 옵션 시도 실패하면 대신 안드로이드의 배경 : SRC를에 이미지 버튼. 모든 문제에 대한 해결책은 아니지만 이런 종류의 문제에 대해서는 잘 작동합니다.

관련 문제