‘Missing contentDescription attribute on image’ in XML

I get an warning about [Accessibility]Missing contentDescription attribute on image in eclipse. This warning show at line 5 (declare ImageView) in XML code below. This not make any error when build and run my application. But I really want to know why i get this warning. This is my XML file: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout … Read more

How to create a circular ImageView in Android? [duplicate]

This question already has answers here: How to make an ImageView with rounded corners? (58 answers) Closed 8 years ago. How could I create a rounded ImageView in Android? I have tried the following code, but it’s not working fine. Code: Bitmap circleBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888); BitmapShader shader = new BitmapShader (bitmap, TileMode.CLAMP, TileMode.CLAMP); … Read more

Changing ImageView source

I have an ImageView with a source image set in the xml using the following syntax: <ImageView android:id=”@+id/articleImg” style=”@style/articleImgSmall_2″ android:src=”https://stackoverflow.com/questions/2974862/@drawable/default_m” /> Now I need to change this image programmatically. What I need to do is delete the old image and add a new one though. What I have done is this: myImgView.setBackgroundResource(R.drawable.monkey); It works but … Read more

How to scale an Image in ImageView to keep the aspect ratio

In Android, I defined an ImageView‘s layout_width to be fill_parent (which takes up the full width of the phone). If the image I put to ImageView is bigger than the layout_width, Android will scale it, right? But what about the height? When Android scales the image, will it keep the aspect ratio? What I find … Read more