I created some icons for buttons in my application. I think this search field looks nice:
Or does it? This is what you get on Samsung Galaxy S6 with that crazy-ass DPI screen:
Qt did scale font size and field size as I wanted, but the button icon is exactly the same size on both pictures. Here's full scale image for comparison:
I used Qt Designer to add the icon from resources:
So what I need is to get Qt to properly make my icons larger or smaller so that they fit the button. I actually expected that it will happen automatically, silly me.
Related
We have a big xamarin project. We have multiple splashscreens, for phone and for tablet. The splashscreens have a logo on them, which can't be stretched. You can put a splashscreen in the drawable folders, but then you can't detect if its a tablet or phone.
How is it possible to configure multiple splashscreens, not only based on the drawable folders? Thanks in advance.
Although this may not be the fix you are looking for, I can suggest looking at the Xamarin guide for detecting screen density . Here you can set a certain threshold (certain number of pixels in height and width means it is a tablet) and set one of two drawables you have. One splash screen for tablets and the other for phones.
I don't know what the splash screen looks like, but if it is simply the logo that is important (say if you have a solid color background) possibly make a layout that fills the screen with a background color and center_horizontal + center_vertical your logo drawable (that way you only need one drawable for all splash screens)
So, I am just a beginner and I already went trough android documentations about supporting different screen sizes and I understand most of it.
For my app, I created different layouts for each screen sizes and on the emulator it looks good.
Just one question.
How should I export images to my drawable hdpi.lpdi,...mdpi...folders?
Because, What I did was, I used art text2, and created a project with 700x700. Well. I set it to transperant, so it's not excatly 700x700px. cause the image does not fill the entire space.
So, before I hit export, should I change the PX Resolution for example for 450x450 or something for mdpi? But, I didn't do that, and I amnot sure if I should have done that. then i hit export and it asks me where i want it to save the image. It also gives the me option to the change the DPI Resolution in DPI, i changed to 160 and saved that in my drawable/mdpi folder. But I did not change PIXEL resoultion.
So, was it correnct? or should I have changed the pixel resoultion before, I export the actual image?
In Eclipse, However, I change the width and height of the image in dp not px. so it doesn't take the entire screen space.
I checked my app on different screen sizes in Eclipse and it looks awesome. But, in the emulator, it looks cool. HOWEVER, if open my hdpi emulator the image does not look very sharp or clear. What's the problem?
The image itself looks clear and sharp if open it with my image viewer on my computer even, the image viewer window is almost taking the entire screen of my laptop (14,1280*800).
I will suggeset you to use 9patch image. you can create 9patch image using android tool called draw9patch Located in sdk/tools.What you have to, create a high resolution image and then give to draw9patch tool it create image with extension .9.png and use that image
See the link for detail
http://developer.android.com/tools/help/draw9patch.html
Okay if i understood right, then you need to have 4 res for each image, and the aspect ratio will be "1:1.5:2:3" and some times "1:1.5:2:3:4" so you have to get all the images that you need in 3 or 4 sizes and let the android os properties do its magic by choosing the right picture based on the screen size.
What is the applications screen size without the status bar and softkeys(in some phones)?
Like for Example i know:
320X480 trimmed down to 320X455 which is the basesize.
but what about others , i have done many calculations and a lot of searches online to figure out a defined size for other screen but i seems can't, Also While applying the formula *.75 ldpi, *1.5 hdpi, *2.25 xhdpi to get other screen, it doesn't add up.
Like 320X480 is mdpi to get the hdpi do *1.5 and you will get 480X720 which is not the situation for devices out their ! and using this method my application images where stretched, this method is according to the Google documentation, i'm confused as hell.
I have tried to et sizes using the emulator also it was very different! for height.
So if the problem is with height only, i'm thinking creating background as patterns and then work only on the width of the screen size and re-size every other elements to screen width only like 240px, 320px, 480px, 720px and also consider the size of them to fit minimum height.
I believe it's not possible to define a height for android which will go like generic because of the variety of android devices.
So what do you think about this approach to use background as pattern and forget about every device on earth height ?
you can use tile pattern, create a small texture and then make it tileable drawable in xml, so it will be tiled across screen, or the second might be using 9-patch images, in that way you can select which area of the image scale and which area to not scale, so they will be scaled according to that way.
Sorry but i cant understand how i can draw a right picture for the right android phone size.
I readed the android documentation, and they say for i just think in screen size and density and not in resolution, so what size should have my picture?
For example,if i have a phone with size 1000x400(stupid example),and want a button(40x40) that will be in middle,what size should i do?? 40x40?? But in documention they say for dont look for resolution :\
Im confuse...
ps: The documention link Android multiple screens
Basically you'll have to realize that although resolution, screen size and screen density are separate attributes, they are still somewhat related. If your button is 40x40 as you mentioned, and that's the size you find looks good in the center on a hdpi(high density) device, you will have to scale it so that it fits accordingly on mdpi(medium density) and xhdpi(extra high density) devices. What I like to do is use PhotoShop or another graphical editor and resize my assets so that they fit on whatever density devices I'm trying to target. I make sure to always use *WRAP_CONTENT* for my height and width attributes and never fixed values.
Also, if you do not include these scaled alternatives in your res/drawable folders..you're basically saying that you're relying on the system to scale them for you, which can be a gamble. So I always go with resizing my assets so that I include a version for all densities. The link you posed explains everything pretty well
I want to put a toolbar in my application. The toolbar will use ImageViews as application buttons. I would like the ImageViews to be the exact same size regardless device; by "same size" I mean that, when rendered to the screen, if I measure them with a ruler, the dimensions will be the same. I would like this size to be ~10mm (the width of my index finger).
I have been completely unsuccessful in accomplishing this.
I am testing on a MDPI, large screen Acer Iconia Tab and a HDPI medium screen Samsung Galaxy Tab. If I set layout_width="50dip" and layout_height="50dip", the buttons render as ~10mm on the Samsung, and ~8mm on the Acer. If I set the buttons as layout_width="12mm" and layout_height="12mm", they render as 12mm on the Acer and ~9mm on the Galaxy (confusing that 50dip renders bigger on the Galaxy than the Acer, but 12 mm renders smaller on the Galaxy than on the Acer).
If I place a 32pix x 32pix icon in my drawable-mdpi folder (and no equivalent in the drawable-hdpi folder), and set layout_width="wrap_content" and layout_height="wrap_content"; the results are similar to if set to 50dip, the Samsung is about 10mm, the Acer about 8mm. If I add a 48pix x 48pix icon to my drawable-hdpi folder, there is no change; presumably because the Acer still uses the mdpi icon and the Samsung uses the bigger one, but scales it down by 50% because it knows its hdpi (if am confident that this surprising scaling occurs because if I move the 48pix icon to the mdpi folder, and have nothing in the hdpi folder, the icon shows very large on the Samsung).
I am confused and could really use advice. How do I make my button fingertip sized regardless of dpi and screen size?
Ok, I finally figured out what is going on:
The problem is that a image button who's width is specified as 10mm,
shows as about 7mm on my Galaxy tab, and about 9mm on my Iconia Tab.
There are 2 reasons for this rather significant difference:
The Iconia Tab reports its xdpi as ~160, when its actual xdpi
is ~150.
Honeycomb uses a new drawable for its button background, with
significantly smaller margin than the drawable in Froyo.
Issue 1 accounts for about .6mm of the difference, Issue 2 accounts
for the remainder. Issue 2 can be solved by choosing one of the two
backgrounds, packaging it with the application, and specifying it as
the background for the ImageButton. Issue 1 cannot be resolved, but the difference it creates is relatively minor once issue 2 is dealt
with.
You have two basic approaches:
Use supplied resource indentifiers - hdpi/ldpi/etc - and just rely on the OS.
Use xdpi/ydpi in DisplayMetrics class. They are supposed to return the exact physical pixels per inch and scale the image manually with a corresponding scale factor. This, of course, will slow down performance. What is more - I am not sure whether these readings will be correct.
Did you try stuff in the no-dpi resource identifier. Honestly I'm not sure what you would get out of this but it's worth a shot.