How to hide the background of images in the android studio app?

Asked

Viewed 670 times

1

I’m new in programming I’m programming an app in android studio that is practically ready. When I copy it on my Moto G2 with android 6.0 works perfectly however when I copy on the Moto X1 android 5.0 all images appear the background overlapping those that are below even the app icon appeared the background what does not happen on the Moto G2 and all images are in GIF format. I have no idea what the problem may be since it works on G2 and X1 not. If you can help me thank you.Moto G2Moto X1

  • 1

    Do you use any lib to display the images? They make this correction for you, the one searched by Glide or Picasso, are great.

2 answers

1

Whoa, that’s all right!?

To upload images, use some library to upload, recommend the Glide, but it also has the Picasso

If you want to use the app offline later, Glide can save the image cache, and it will work offline.

In case of a dynamic upload url

GlideApp.with(mContext)
  .load(urlImagem)
  .diskCacheStrategy(DiskCacheStrategy.ALL)
  .into(imageView);

In case of local image in drawable

Glide.with(mContext)
    .load(R.drawable.minhaImagem)
    .into(imageView);

If n when you want to use the library above, you have this option too:

By default, JPEG compression would store transparent background pixels in black color. So, it is best to avoid compacting it as JPEG.

If you want to store and recover PNG images, store your source images in PNG format and then recover them.

bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);

0

Ideal is that the images of your application are in format png (not obligatorily) so that they can behave in the same way in all devices and preferably have a transparent background. You can also use libraries like Picasso to work with images, take a look at this Google article talking about how to treat images (9-patch) for your app, 9-patch.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.