I want to change the color used to indicate a selected radio button. I've found an explanation of how to do so. The only thing I'm missing is a source of images to use. To maintain a consistent appearance I want to take the existing images that are used by default and just recolor them. I've seen a guide explaining to get the images in the past, but when I try searching I'm unable to find it.
You can find the images as part of the SDK:
x:\path\to\SDK\platforms\android-17\data\res\drawable-mdpi
The images from the radio button beginns with btn_radio.
As cafelatte notes you need to provide the 4 differnt densities. There are four types:
ldpi: Resources for low-density (ldpi) screens (~120dpi)
mdpi: Resources for medium-density (mdpi) screens (~160dpi). (This is the baseline density.)
hdpi: Resources for high-density (hdpi) screens (~240dpi).
xhdpi: Resources for extra high-density (xhdpi) screens (~320dpi).
Either create your own resources, or pull what you need from the SDK.
In ${your-sdk-dir}\platforms\android-${apilevel}\android.jar
Simply take the resources you need from under the res\drawable* subdirectories. Don't forget to provide [l/m/h/x]dpi resources if required.
Related
I created layout-sw600dp/layout.xml and it was looking great on device A. But on device B this layout has melt and looks bad. I want to know how my layout looks in worst possible case scenario (exactly 600dp width screen)
I want to create emulator with that screen size, so I will 100% sure that my layout will be looking good on sw-600dp+ phones. Do you know what size it is?
Also, I would really appreciate and be happy if you could give me an advice how to support multiple screen sizes in a modern world.
P.S. I have pretty difficult layouts with 40+ buttons
The short answer to your question regarding the type of emulator you'd use for sw-600dp+: a 7" tablet. You can find more information here. The sw in sw-600dp is the smallest width qualifier. It means that it is only mean to be used for devices with 600dp, which is typically 7" tablets.
The longer answer to your question about how to make sure your app look good "in a modern world" is:
Rather than trying to figure out what is the "worst case scenario", you should design layouts for each of the different screen densities and device types that Android supports:
ldpi Resources for low-density (ldpi) screens (~120dpi).
mdpi Resources for medium-density (mdpi) screens (~160dpi). (This is the baseline density.)
hdpi Resources for high-density (hdpi) screens (~240dpi).
xhdpi Resources for extra-high-density (xhdpi) screens (~320dpi).
xxhdpi Resources for extra-extra-high-density (xxhdpi) screens (~480dpi).
xxxhdpi Resources for extra-extra-extra-high-density (xxxhdpi) uses (~640dpi).
Per the Android docs:
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:
36x36 (0.75x) for low-density (ldpi) 48x48 (1.0x baseline) for
medium-density (mdpi) 72x72 (1.5x) for high-density (hdpi) 96x96
(2.0x) for extra-high-density (xhdpi) 144x144 (3.0x) for
extra-extra-high-density (xxhdpi) 192x192 (4.0x) for
extra-extra-extra-high-density (xxxhdpi) Then, place the generated
image files in the appropriate subdirectory under res/ and the system
will pick the correct one automatically based on the pixel density of
the device your app is running on:
res/ drawable-xxxhdpi/
awesome-image.png drawable-xxhdpi/
awesome-image.png drawable-xhdpi/
awesome-image.png drawable-hdpi/
awesome-image.png drawable-mdpi/
awesome-image.png
You would do the same thing for layouts, creating a specific layout for each of the various dimensions (be sure to put the layouts in the right directories: layout-xhdpi, layout-mdpi, etc.). Doing this will allow the device to select the correct image/layout based on the device the user is using.
If you have a 40+ button layout, you would create buttons for each layout using the above method, then create layouts for each device. It's tedious work, but it is the correct way to do layouts on Android devices.
TLDR; read the Android documents around supporting multiple screen sizes.
hi guys i am having a bit of a hard time i have an android application that uses image buttons in the display so far i have been testing on the same device however when i install it on certain devices some of my icons are not visible doe it still occupies the same space and if you click on where they are suppose to be they still trigger their intended actions i am using png images in the recommended dimensions/densities saved in the drawable folders
36x36 for low-density (LDPI)
48x48 for medium-density (MDPI)
72x72 for high-density (HDPI)
96x96 for extra high-density (XHDPI)
180x180 for extra extra high-density (XXHDPI)
192x192 for extra extra extra high-density (XXXHDPI)
plese let me know how to resulv this
use low dimension images
Reason, when rendering image on Screen OpenGLRenderer was not loading bitmap for high resolution devices and hence no image was coming on nexus devices.
please refer :- Android Lollipop not showing android:background image
please let me know if it is dose not work for you.
Hi in the below layout icon displaying small and as well as icons not occupying full screen.I want to occupy the icon in full screen and icon should be in bigger size.!
If I am using small mobiles it occupying full screen and icons also displaying correct size.when I am installing my app in this device it's giving two problems.
Can any one help me from this issues.
Thanks in advance
Check the official documentation for explicit information.
Any android phone has one of this six screen densities.
ldpi Resources for low-density (ldpi) screens (~120dpi).
mdpi Resources for medium-density (mdpi) screens (~160dpi).
(This is the baseline density.)
hdpi Resources for high-density (hdpi) screens (~240dpi).
xhdpi Resources for extra-high-density (xhdpi) screens (~320dpi).
xxhdpi Resources for extra-extra-high-density (xxhdpi) screens (~480dpi).
xxxhdpi Resources for extra-extra-extra-high-density (xxxhdpi) uses (~640dpi).
Use this for the launcher icon only, see note above.
Create icons of different sizes for different screen resolutions and put those icons to yourProject/app/src/main/res/drawable-mdpi or -hdpi or -xhdpi or -xxhdip folder.
I believe the issue here is that even though the tablet has high resolution, it still has low density due to its large screen size. So, the tablet is picking the image from low density folder which makes it look small on large scree.
The discussion here sheds some light on the issue. Basically you are required to create separate drawable folders for tablet's width. Ex. drawable-sw600dp and drawable-sw720dp etc.
Refer developer guide for more details.
Am create an app that integrating zxing. I followed as per this site http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/. Now i have error in drawable folder. Please guide me.
Thanks in Advance.
As you are dividing according to density to achieve multiple size support inside your android app.
But there ain't any xxhdpi.
ldpi Resources for low-density (ldpi) screens (~120dpi).
mdpi Resources for medium-density (mdpi) screens (~160dpi). (This is the baseline density.)
hdpi Resources for high-density (hdpi) screens (~240dpi).
xhdpi Resources for extra high-density (xhdpi) screens (~320dpi).
nodpi Resources for all densities. These are density-independent resources.
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.
There's no need of drawable-xxhdpi inside res/ of project. So please remove it.
For more details follow up these configuration qualifiers
How to define different style for same layout according to screen size.
Is there any way to define such thing, except from different layout folder for different screen size.
I haven't found any other way to support different screen.
Use different folder for different screen resource:
ldpi Resources for low-density (ldpi) screens (~120dpi).
mdpi Resources for medium-density (mdpi) screens (~160dpi). (This is the baseline density.)
hdpi Resources for high-density (hdpi) screens (~240dpi).
xhdpi Resources for extra high-density (xhdpi) screens (~320dpi).
You better have a look here.
You can have different values folder as you have different layout folder
such as values-large, values-land, values-large-land