Tag: 图像

我们可以在xml中为android背景制作多个颜色渐变吗?

我一直在尝试在XML中创建多色背景,但只有3个选项可用,包括开始,中间,结束和指定的角度。 我们不能让这样的背景下面.. 我们可以在android中像这样的背景?

Java将Image转换成BufferedImage

在StackOverflow上已经有这样的问题了,接受的答案是“cast”: Image image = ImageIO.read(new File(file)); BufferedImage buffered = (BufferedImage) image; 在我的程序中,我尝试: final float FACTOR = 4f; BufferedImage img = ImageIO.read(new File(“graphic.png”)); int scaleX = (int) (img.getWidth() * FACTOR); int scaleY = (int) (img.getHeight() * FACTOR); Image image = img.getScaledInstance(scaleX, scaleY, Image.SCALE_SMOOTH); BufferedImage buffered = (BufferedImage) image; 不幸的是我得到运行时错误: sun.awt.image.ToolkitImage不能转换为java.awt.image.BufferedImage 显然铸造不起作用。 问题是:什么是(或有)正确的方式转换图像到BufferedImage?

使用Kotlin将图像从ImageView传递给Android中的另一个Activity

如何将使用Kotlin在ImageView选择的ImageView传递给Android中的另一个Activity? 这是使用内部存储选择ImageView内部的ImageView方法,我需要将图像传递给另一个活动 fun Loadimage() { var intent = Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI) startActivityForResult(intent,ImageCode) } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode==ImageCode && data!=null && resultCode== Activity.RESULT_OK) { val selectedImage = data.data val filepath = arrayOf(MediaStore.Images.Media.DATA) val cursor = contentResolver.query(selectedImage,filepath,null,null,null) cursor.moveToFirst() val Index = cursor.getColumnIndex(filepath[0]) val Picture = cursor.getString(Index) cursor.close() imageView.setImageBitmap(BitmapFactory.decodeFile(Picture)) } […]

Kotlin:将图像保存到数据库

我在kotlin创建用户配置文件,我想给用户两个选项(从头像选择或捕获图像),然后保存在“sqlite”数据库中的配置文件 什么是最好的解决方案? 如果你在代码中帮我,我会很感激