imageview

Dynamically Tint drawable in adapter change color for all

試著忘記壹切 提交于 2020-08-11 03:06:05
问题 I get an array of strings from my server using a volley connection. Every single string contain a different color in hex. I use this color to set Tint of a drawable in adapter. Here my code in adapter: @Override public void onBindViewHolder(@NonNull final ViewHolder holder, final int position) { // Get item from position MyObject object = array_data.get(position); ... ... Drawable unwrappedDrawable = AppCompatResources.getDrawable(context, R.drawable.ic_beenhere_black_24dp); Drawable

Dynamically Tint drawable in adapter change color for all

浪子不回头ぞ 提交于 2020-08-11 03:05:20
问题 I get an array of strings from my server using a volley connection. Every single string contain a different color in hex. I use this color to set Tint of a drawable in adapter. Here my code in adapter: @Override public void onBindViewHolder(@NonNull final ViewHolder holder, final int position) { // Get item from position MyObject object = array_data.get(position); ... ... Drawable unwrappedDrawable = AppCompatResources.getDrawable(context, R.drawable.ic_beenhere_black_24dp); Drawable

How to convert imageview to bytearray in kotlin

橙三吉。 提交于 2020-08-06 07:19:11
问题 How to convert imageview to bytearray kotlin android In java Bitmap bitmap = ((BitmapDrawable)image.getDrawable()).getBitmap(); ByteArrayOutputStream stream=new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 90, stream); byte[] image=stream.toByteArray(); return image 回答1: Here it is use java to kotlin converter. val bitmap = (image.getDrawable() as BitmapDrawable).getBitmap() val stream = ByteArrayOutputStream() bitmap.compress(Bitmap.CompressFormat.PNG, 90, stream) val

How to set rounded corners of Image View

纵然是瞬间 提交于 2020-06-29 04:42:08
问题 I'm create a Image View using of com.github.chrisbanes.photoview.PhotoView I wanna to set rounded corner programmatically of this photoview. If You know other library which is help me to pinch to zoom image and i set rounded corner as well then suggest me. 来源: https://stackoverflow.com/questions/62371965/how-to-set-rounded-corners-of-image-view

Load image from URL to imageView as well as Cache

旧城冷巷雨未停 提交于 2020-06-25 21:00:32
问题 Hi i am new beginner in android. I want to insert image in imageView from URL but whenever one time it is loaded from URL in imageView then second time it should be insert without internet means it would be stored in cache as well. 回答1: for this you can use picasso Library You can download it from Picasso Library site simply put this jar file into libs folder. It will manage all property of Image. http://square.github.io/picasso/ String imgURL = "Your URL"; ivmage = (ImageView) findViewById(R

Load image from URL to imageView as well as Cache

旧城冷巷雨未停 提交于 2020-06-25 20:59:12
问题 Hi i am new beginner in android. I want to insert image in imageView from URL but whenever one time it is loaded from URL in imageView then second time it should be insert without internet means it would be stored in cache as well. 回答1: for this you can use picasso Library You can download it from Picasso Library site simply put this jar file into libs folder. It will manage all property of Image. http://square.github.io/picasso/ String imgURL = "Your URL"; ivmage = (ImageView) findViewById(R

Query in image size in android studio

南笙酒味 提交于 2020-06-17 09:10:48
问题 Hello. There is a ball image of 640X480.In the image, as you can see I have specified layout_width as 849px and layout_height as 680 px.I have taken a background colour of blue.As layout_width specified is much more than 640px(width size of image), then why the image's left side and right side is not surrounded with blue background.Image's top and bottom is surrounded with blue background. XML Code: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout

Query in image size in android studio

杀马特。学长 韩版系。学妹 提交于 2020-06-17 09:09:54
问题 Hello. There is a ball image of 640X480.In the image, as you can see I have specified layout_width as 849px and layout_height as 680 px.I have taken a background colour of blue.As layout_width specified is much more than 640px(width size of image), then why the image's left side and right side is not surrounded with blue background.Image's top and bottom is surrounded with blue background. XML Code: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout

ImageView with rounded corners in Kotlin

旧街凉风 提交于 2020-04-18 05:36:07
问题 I want to have an ImageView with rounded corners in my Fragment. I've got the following Kotlin code: val imageView: ImageView = root.findViewById(R.id.profile_view) val pv = RoundedBitmapDrawableFactory.create(res, src) pv.setCornerRadius = 0f imageView.setImageDrawable(pv) create and res are red underlined by Android Stuido. create says: None of the following functions can be called with the following arguments supplied: - Bitmap? - InputStream - String res says: Expression expected, but a