드로어 블을 통해 배경으로 설정된 이미지가있는 버튼을 만들었습니다. 프로그램을 실행하면 이미지가 가운데에 맞춰지지 않고 단추에 맞게 축소됩니다. 그러나 클릭하면 눌린 이미지가 제대로 표시됩니다. 이 일은 다른 날에 일하고 있었고 어떤 변화가 있었는지 전혀 모른다.Android : 이미지가 버튼 배경으로 축소되지 않고 있습니까?
main.xml에
<Button
android:id="@+id/rightarrow"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@android:color/transparent"
android:clickable="false" />
Activity.java
rightarrow = (Button) findViewById(R.id.rightarrow);
rightarrow.setBackgroundResource(R.drawable.rightarrow_drawable);
rightarrow_drawable.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/rightarrow_pressed" android:state_pressed="true"/>
<item android:drawable="@drawable/rightarrow" />
</selector>
하지 전체 솔루션 비록와
Button
,이 아이디어는 이미지를 삭제하고 트릭을했던 프로젝트로 다시 다운로드를 알려준. 감사. – jrquick