我有一个很大的按钮,我想设置一个图像作为它的背景。我希望它占按钮空间的 70%,中间有重力。
最佳答案
这样做的“好”方法是使用 9-Patch 图像:
http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch
http://developer.android.com/reference/android/graphics/NinePatch.html
有一个可用的工具:
http://developer.android.com/guide/developing/tools/draw9patch.html
如果您想使用自己的图片,按钮会自动调整为图片的大小。
关于android - 缩放作为按钮背景的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8137956/