我有三个 9-patch PNG,它们共同构成按钮的背景(左侧、中间、右侧)。我想将这三个图像组合在一个drawable中,我可以将其指定为XML中按钮的背景,类似于:
res/drawable/button_background.xml:
<?xml version="1.0" encoding="utf-8"?>
<nine-patch xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/button_left_side" />
<nine-patch android:src="@drawable/button_middle" />
<nine-patch android:src="@drawable/button_right_side" />
res/layout/main.xml:
<button android:background="@drawable/button_background" />
这可能吗?