小编Bin*_*ter的帖子

Java(Android):如何在没有Bitmap的情况下缩放drawable?

我需要缩放按钮的背景图像,但不能将其转换为位图.这是现在的代码:

int height = 50;
int width = 80;

Button b = new Button (this);
b. setBackgroundResource(R.drawable.btn);
Run Code Online (Sandbox Code Playgroud)

现在我需要根据"高度"和"宽度"缩放"R.drawable.btn".setBackgroundResource不接受Bitmap.我怎么做?

谢谢.

scaling android

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

scaling ×1