Reputation: 4405
I have 3 images with the following sizes in pixels (I got them from Get Info
)
300x200
150x100
600x400
Question: How do I know in which resources directory (hdpi|mdpi|xhdpi etc
) I should put them?
Upvotes: 0
Views: 320
Reputation: 419
There are 8 folders available, and each one varies depending on pixel density:
1. lpdi - Resources for low-density (ldpi) screens (~120dpi).
2. mdpi - Resources for medium-density (mdpi) screens (~160dpi). (This is the baseline density.)
3. hdpi - Resources for high-density (hdpi) screens (~240dpi).
4. xhdpi - Resources for extra-high-density (xhdpi) screens (~320dpi).
5. xxhdpi - Resources for extra-extra-high-density (xxhdpi) screens (~480dpi).
6. xxxhdpi - Resources for extra-extra-extra-high-density (xxxhdpi) uses (~640dpi).
7. nohdpi - Resources for all densities. These are density-independent resources. The system does not scale resources tagged with this qualifier, regardless of the current screen's density.
8. tvdpi - Resources for screens somewhere between mdpi and hdpi; approximately 213dpi. This is not considered a "primary" density group. It is mostly intended for televisions and most apps shouldn't need it—providing mdpi and hdpi resources is sufficient for most apps and the system will scale them as appropriate. If you find it necessary to provide tvdpi resources, you should size them at a factor of 1.33*mdpi. For example, a 100px x 100px image for mdpi screens should be 133px x 133px for tvdpi.
To create alternative bitmap drawables for different densities, you should follow the 3:4:6:8:12:16 scaling ratio between the six primary densities. For example, if you have a bitmap drawable that's 48x48 pixels for medium-density screens, all the different sizes should be:
You can have even more information from Android official documentation
Upvotes: 2
Reputation: 126
Copy image and paste to drawable folder. You can add image by using .xml file
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/image_name" />
Upvotes: 1