Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android-创建白色补丁的png图像_Android_Button_Drawing_Png_Drawable - Fatal编程技术网

Android-创建白色补丁的png图像

Android-创建白色补丁的png图像,android,button,drawing,png,drawable,Android,Button,Drawing,Png,Drawable,我有一个.png文件,当我按下按钮时,它会给出一个白色的补丁,而不是透明的背景 我正在使用 btn6.setBackgroundResource(R.drawable.f); 这会将png置于按钮上,但不包括图像的区域会被打成白色。怎么办?我猜您正在使用图像按钮 尝试将XML文件中ImageButton的背景设置为@null android:background=“@null” 在代码中尝试设置imageResource而不是background btn6.setImageResource(R

我有一个.png文件,当我按下按钮时,它会给出一个白色的补丁,而不是透明的背景

我正在使用

btn6.setBackgroundResource(R.drawable.f);

这会将png置于按钮上,但不包括图像的区域会被打成白色。怎么办?

我猜您正在使用图像按钮

尝试将XML文件中ImageButton的背景设置为@null

android:background=“@null”

在代码中尝试设置imageResource而不是background

btn6.setImageResource(R.drawable.f)

编辑: Sikp Xml编辑和执行

btn6.setImageResource(R.drawable.f)

btn6.可设置为空(空)

我认为这不是一个透明的背景png文件。
您应该使用PhotoShop删除白色补丁

我可以这样做,但这将删除我必须首先使用的灰色按钮…我该怎么办?@我需要在一些操作上设置背景以及btn6.setImageResource(R.drabable.f);设置btn6.setBackgroundDrawable(空);在您的操作中删除背景并设置图像源。可能是图像不透明?张贴你们得到的图片和你们试图放在那个按钮上的图片