Alright now this problem might sound funny but I am not here for jokes. However, I use eclipse for android developement, the problem is that whenever i place my icons in the res/drawables
and run the application in emulator the images in the icons become blurry, this is with out the nine patch. However , when i change the icons to nine patch and then place them, the icons become more blurry i dont understand why. Now you see the best part is that the icons dont appear blurry in an android mobile phone(ldpi screen), i suppose the same will go for the others hdpi and mdpi. Why is this happening ? Is there a problem in the transparency ?Are there some changes need to be done in the xml file? Answers , Tips , advices required please .
:)
What is the screen density for the emulator? If you are using small images, when you put them in resources they probably become blurry when they get scaled up.
It may be possible that the density of the emulator is low due to which your images' size get increased and they get faded. try to align the image size and density according to the density of emulator or device. I solved my problem with this.
Related
Since the launch of Nexus 5X and Nexus 6P, I have noticed my layout designed previously looks relatively small on these new two devices. I tried creating multiple Layout resource folders but nothing seems to be working efficiently. After going through multiple tutorials and blogs, I am still struggling with this issue. Any kind of help or tutorial would be really appreciated.
Using multiple layouts is the correct way to solve Layout problem only. Besides, you also need adding suitable drawable resolutions and dimensions.
See more:
Make sure to use dp and sp as your scale.
Make sure if the correct layout folder is being picked by the mobile phone (see note below)
Resolution of image assets must be proportional to the dpi - check the Android icon resolution requirements and scale your image assets accordingly.
*To determine if the app does pick the layout folder you intend the app to pick - you could change the background for different layout folders and determine which one it picks *
it's my first time to develop for Android and I almost finished the app but when I started testing it I faced some problems related to UI. I tested the app while programming it using galaxy s6 edge plus which has a 5.7" 1440x2560 screen, the app has many textviews and I used "sp" units for their text sizes and also used "dp" units for the margins between them. For some textviews I set their backgrounds as a drawable xml in which I set a value for their width and height using "dp" units instead of using wrap_content because I want the backgrounds to be larger than the text inside it so the user can easily touch it. I also made a large-layout folder where I put new xmls inside it with larger fonts so that they work will on tablet and they did, I tested the app on a tablet and it looks great using these xmls and also the app looks great on the 5.7" phone with the normal textviews. Then I tested it on 2 phones with smaller screens each of 5" one of them with Full HD resolution and the other with HD resolution and it looked good on both of them too but when I tested it on a phone with 5" screen but low resolution (480x800) the app looked terrible, textviews interfering with each other and the drawable backgrounds are too big, in short the whole UI is a mess.
What I need to know is whether I also have to test the app for more screen sizes below 5" or for other resolutions too? Because if this is the case then this means so much work!
This is a screenshot of the code for the textview with the drawable background
Thanks in advance
Go through this tutorial: http://developer.android.com/training/basics/supporting-devices/screens.html and this too: http://developer.android.com/training/multiscreen/index.html
I'm sure this will help you out.
If you still encounter any problem, feel free to ask again!
Peace.
I am pretty new to Android and I am doing a pet project in order for me to learn Android. Basically I want to display six images on the screen. I have noticed the drawable folders and I have 256x256px inages in the drawable-xhdpi folder. In the Nexus 5 preview in android studio it looks great but in Nexus 7 (2012 version) the images are very small and both Nexus 5 and Nexus 7 are using the drawables-xhdpi folder.
This is my code:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageMars"
android:id="#+id/imageJupiter"
android:src="#drawable/jupiter"
android:contentDescription="#string/content_desc_jupiter"
android:layout_toRightOf="#+id/imageVenus"
android:adjustViewBounds="true"/>
How can I make the images look bigger on the Nexus 7, but without being to big for the nexus 5?
And I want the application to look good on other devices too, so I don't think that setting a fixed size for the image(70dp x 70dp for example) would work
Thank you
Best practice in Android is to provide the correct size images in each of those folders and let the system choose the best one based on the device. Supporting Multiple Screens is a must read.
Basically what happens is the system will navigate to the folder that would best satisfy its screen, if the image it needs is there, great; if not it will navigate to the next best folder and so on. If it cannot use the best for the device it will use the best you gave and try its best to make it look as good as possible. Sometimes this isn't so great. It can stretch or shrink images into an ugly state.
So again, the best thing to do is provide multiple sizes of the same image in each of the folders to get the desired results.
Edit (response to commentary):
Guess not. In Eclipse/ADT I've got
Nexus 4 # 768x1280 - Normal xhdpi
Nexus 7 (2012) # 800x1280 - Large tvdpi
So regardless of "larger" the fact remains that they're pulling resources from different drawable folders. The tvdpi is said to be not needed in most apps because it's somewhere between mdpi and hdpi and those folders are usually sufficient. Maybe add the tvdpi and see if it varies at all and make sure you've correctly scaled your images based on the folder.
Edit:
Alright, the behavior you're experiencing is normal - unfortunately I suppose - but I found a solution. I've personally never faced this because I learned it's better to utilize the extra area on larger screens to put more content on there.
Anyway, as if you didn't have enough drawable folders, you need another drawable folder, or three, along with more images - yeah!
In my previous edit I mentioned the "Normal" and "Large" modifiers of the drawable folders as they appear in Eclipse ADT. Well, it turns out that those are valid folders as well and certain devices with small, large, or xlarge screens will use them.
I was able to get larger images by adding another res directory titled drawable-xlarge-xhdpi; this is for the Nexus 10. I enlarged your jupiter file to 512x512 and...
Note: I read that this isn't a recommended solution but could not see anywhere in the Android docs that warned against it. Research may be necessary!
You should provide different image sizes for different display sizes/resolutions. That what the drawable-100w, etc folders are.
If you don't want to do that but you still want the images resized to use all the available space, you will have to do resize the ImageView elements programmatically.
i´m pretty new to android development and creating different layouts for each resolution wasn´t really that easy for me.
So, I was able to optimize my app for most devices (in eclipse), but i´m still having some problems here and there:
do I really have to copy the same images with different resolutions for each device-resolution into the respective folder? I´m currently using the hdpi, large-hdpi, mdpi and xdpi folders...
isnt it possible to use one drawable-folder and just scale the images down?
is there an extra drawable-folder for those 5.1in (WVGA)/5.4in (FWVGA) devices? In eclipse they´re labeled with mdpi, but these devices are using the large-hdpi folder and those images are too big, but perfect for i.e. nexus 7.
i´m also using 4 different layout-folders (layout-sw360dp, sw480dp, sw600dp & sw720dp). Is that a proper way to create a layout for each device-group?
Hopefully someone is able to help me with this.
Thanks in advance!
1) Yes you have to copy the images with different resolutions for each device resolution into respective folder. Because if you don't do that you will have unexpected results on different screen sized i.e. misplaced controls and layout will not be proper.
2) If you scale the images then they will get stretched or squeezed and you will not get proper result on the screen.
3) Folders sometimes behave differently on different devices. Sometimes they don't use the folders they are intended to use.
4) Yeah! as recommended in the documentation it is a good practice to use different folder as you can't be sure of the screen sizes in android.
I am going to develop an android app, but unlike my previous apps, this time I have to tell someone what graphics and assets I require even before starting the development. The designer has designed all the screens, and now looking at those screens I have to tell him what resources(in what sizes and densities), fonts, icons etc I require.
Does there exist a checklist, which cleanly lists all the required graphics(for different sizes and densities), and assets including those graphics which are required only at the time of app publishing.
I work in a company where I have to tell designers as well. So despite any hard mapped check list, it always helps if you make the designer understand a bit on how the Android works.
Don't forget that color codes, XML drawables (borders, gradients) and 9-patch are way more efficient than static PNGs.
Then I make him do everything just for the Galaxy Nexus on XHDPI and only after the whole development is complete that I ask for the other resized assets (because assets tend to change throughout the project and then I don't have to be updating all of them).
Despite what is on the mock-ups is just a few more assets:
launcher icon,
high-res launcher (512 x 512)
promotional graphs (180w x 120h)
feature graphic (1024 x 500)
the other you'll use registering on Google Play is the screen shots which you can get from the real app, after it's complete.
The previous answers totally answers this question but I just wanted to add something to Budius. I know I am not suppose to reply to other answers but as a Designer I think I should point something out.
Budius said "make him do everything just for the Galaxy Nexus on XHDPI". I would suggest having him make everything on MDPI as MDPI is the current baseline. Reasoning behind this is that in no matter what program used, ex: Photoshop, it is much more cleaner to scale up than to scale down. Scaling down sometimes results in weird artefacts and require adjustments where as scaling up usually results in a perfect scale.