2011-12-02 5 views
2

사진을 넣을 버튼이 있습니다 ... 버튼 내부의 이미지 크기를 조정해야합니다 ... 어떻게 크기를 조정할 수 있습니까? xml 코드에서 직접 할 수 있습니까? drawableTop/좌/하단/우측 특성에 대한 이해가 오히려 정상에 올려 놓는 것입니다, 당신의 버튼 내부에 이미지를 배치하지 않을 올바른지이미지 크기 조정 버튼

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/layout_root" 
     android:orientation="vertical" 
     android:layout_width="250dp" 
     android:layout_height="180dp" 
     android:paddingLeft="4dip" 
     android:paddingRight="4dip" 
     android:background="@color/white_trasparent" 
     android:weightSum="1"> 

    <TextView 
     android:layout_height="wrap_content" 
     android:id="@+id/text" 
     android:textColor="@color/grey" 
     android:textAppearance="?android:attr/textAppearanceLarge" 
     android:layout_width="wrap_content" 
     android:layout_marginLeft="15dp"> 
     </TextView> 
    <Button 
     android:layout_width="wrap_content" 
     android:text="Drawable Top" 
     android:id="@+id/Button03" 
     android:drawableTop="@drawable/icon" 
     android:layout_height="wrap_content" 
     android:textSize="10dp"> 
     </Button> 
</LinearLayout> 

답변

0

: 이 XML 코드입니다 (북쪽).

버튼 안에 이미지를 넣으려는 경우 ImageButton을 확인하십시오.

이러한 것들 중 하나만 사용하면 이미지의 크기 만 설정할 수 있다고 생각하지 않습니다 (이 경우 전체보기의 크기를 변경할 수 있습니다.이 경우 사각형 단추 상자와 내부 이미지 그것.)

버튼 상자 그래픽의 크기에 영향을주지 않고 이미지의 크기를 변경하려면 포토샵이나 기타에서 리소스 이미지를 축소해야한다고 생각합니다.