나는 안드로이드에서 사용자 정의 버튼을 사용하고 있는데 사용자 정의 스타일을 설정하고 버튼의 뒷면에서 적용하면 내 이미지가 스트레치 버튼 배경이 아니며 버튼 크기에 기반한 배경을 늘리고 싶습니다. ' 사용자 정의 버튼 XML 코드 :안드로이드 Cusom 버튼 스트레치 배경
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/editText1"
android:layout_centerHorizontal="true"
android:layout_marginTop="28dp"
android:text="Button"
android:background="@drawable/custom_button" />
:
custom_button.xml
<?xml version="1.0" encoding="UTF-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:drawable="@drawable/disable" />
<item android:state_enabled="true"
android:state_pressed="true" android:drawable="@drawable/pressed" />
<item android:state_enabled="true"
android:state_focused="true" android:drawable="@drawable/focused" />
<item android:state_enabled="true"
android:drawable="@drawable/normal" />
</selector>
여기 내 레이아웃 XML 코드 버튼 스타일의 XML 코드를 참조입니다
사람이 크게 감사와 함께이 문제를 해결하는 방법을 나에게 도움이 될 수 있습니다 :
여기에 스크린 샷 아래에있는 내 출력입니다!
미리 감사드립니다.
내가이 열려 있지만 쇼 지침 draw9patch.bat 발견? – Dinesh