1

当我使用 Button.setBackgroundDrawable(drawable) 时,drawable 对象被拉伸而不是保持其纵横比。如何保持纵横比?我不能使用 ImageButton 因为我还需要在按钮上写文本的能力。FWIW,图像是从文件加载的 BitmapDrawable。

编辑:我想调整按钮的大小以适合图像。

4

1 回答 1

1

What type of background will the buttons have? Is it an image of something? Or just a custom border and color scheme and what not?

If it is just a custom button look, I would look into using 9-patch drawables. They will allow you to make buttons of all different shapes and sizes and have the corners of your buttons maintain the proper sizing.

于 2011-06-28T16:38:26.470 回答