Confusion about drawing and mipmap capability in Android Studio from an older example in the book

[Disclaimer: First of all I know there are a lot of posts about drawable and mipmap folder, I read their descent)

From the book Android Programming - The Big Nerd Ranch Guide, there is an example where I need to insert an icon next to some text on Button

. For higher resolution screens, it makes sense to include multiple icon sizes. In their solution, they have all their images in many different drawable folders with different image resolutions.

I got it working by just putting the icons in the dropdown after a lot of trial and error to get it working in the mipmap folder:

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/next_button"
    android:text="@string/next_button"
    android:drawableRight="@drawable/arrow_right/"/>

      

However, I am a little confused about how this works:

  • People often say that only the application icon should be placed in the mipmap folders, is this true? What is an app icon? Others say that only launcher icons should be placed there, while others say that only icons should be placed there. What are they, they are mutually exclusive options!
  • I cannot auto-complete the mipmap folder in Android Studio, which makes me think I should put everything in my drawable folder, as Android Studio does auto-complete for me. But by default the dropdown folder has no subfolders. This leaves me to believe that the dropdown folder should no longer be used for images with different resolutions, as why shouldn't others have folders by default, so everyone can make spelling mistakes.
  • When wouldn't it make sense to have icons in different resolutions? I can't imagine someone not wanting the highest possible resolution.

From here I got some confusion:

The mipmap folders are only for hosting application icons.

What does it mean? From google translate I get:

icon: a symbol or graphical representation on the screen of a program, option, or window, especially one of several to choose from.

+3


source to share


1 answer


Different uses of mipmap and accessible folder

Finally I figured out the difference between mipmap and pushed folder by looking at the official google docs

And when to put something in your folder:

Bitmap files (.png, .9.png, .jpg, .gif) or XML files that are compiled into the following available resource subtypes:

Bitmap files

List item Nine patches (resizable bitmaps) Contains a list of shapes Animation Drawings Other Drawings See Drawing Resources

Qualifiers added to folder names have special meaning in android

It is also noticeable that there are multiple folders with different permissions for the default launcher icon, but not for the dedicated folder. Android OS looks for this folder with special names called qualifiers. For example, dedicated folders have the following qualifiers and more:



ldpi HDI xdpi

These qualifiers are appended to these resource folder names, such as drawable-ldpi, drawable-hdpi, and drawable-xdpi, so the Android operating system will look in these folders to find the best file resolution in the folders.

To answer the questions from above:

People make the mistake of using the term icon when they actually mean a launcher icon. The launcher icon should be placed in the mipmap and is the default. Nothing other than the launcher icon should be placed in the mipmap Android provides to make it easier to change the app based on certain device settings such as screen resolution and screen orientation. This is important to include different sized versions as scaling and scaling can be made much more precise to fit all types of screen sizes.

Hope this helps anyone. It's hard for me to find it.

+11


source







All Articles