I think the phone uses the layout-hdpi file but this doesn't seem right, mostly because its dimensions(540 x 960) are not what I'm used to seeing(480 x 800) for layout-hdpi phones. So what is the actually layout file used? Also, if it is layout-hdpi phone how can I stretch an icon that has a width of 480 to 540? Would I programmatically have to test the phone's dimensions and then expand the drawable-hdpi file to fit the various device dimensions? I looked at this link but they never specified what layout file was used.
Yes, HTC Evo 3d use drawable-hdpi images. You should have to put the Layout file also. Put the same file into layout-hdpi.
Now create the Emulator of the Resolution 540 X 960. And test the App in it. There should be minor difference between normal hdpi and HTC Evo Screen resolution. Manualy test it.
I am getting same trouble before some days. What i have done is: I am going to check the resolution of the devide screen size at run time. And if the Resolution is compare to that HTC Evo 3d then it will set the height and Width of the All Images at run time that fit to the HTC Screen Resolution.
That was the Best Solution i found till today to Make app for HTC Evo 3d.
For Checking the Resolution at run-time you can use this:
Display display = getWindowManager().getDefaultDisplay();
DisplayMetrics dm = new DisplayMetrics();
display.getMetrics(dm);
int width = display.getWidth();
int height = display.getHeight();
if((height==960) && (width == 540)){
// Do change the Image Height or Width or position
}
Enjoy. :)
Related
I want to change text size by screen resolution to phones and i used with dimens like this:
I set by Screen Height and its works fine with phone like naxus 5 or pixel 3XL.
My question is if this is how I should define? What did I do well enough to fit any cell phone and tablet?
The files listed above will most certainly cover any android device or tablet. You can always add more configurations if you eventually find a device that isn't utilizing the correct dimens.xml that you desire. There are so many android devices of all shapes and sizes, it is hard to have a coverall approach by using xml files.
Another option would be to programmatically set the the font size based on a ratio of the screen dimensions which can be found below. Exactly how to best do that would depend on how your app is set up.
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int height = displayMetrics.heightPixels;
int width = displayMetrics.widthPixels;
Using the height and width above you could change the font size. However, Where exactly to do that in your code depends entirely on how your app is set up.
In normal i have canvas size 500x500 and it will create camera size (500,500)
But when i change
game.camera.width=5;
game.camera.height=5;
then visible area it the same? what will happen when change width and height camera, how to understand that thanks
Based upon the documentation and an older post from the creator of Phaser on the HTML5 Game Dev Forum where he said:
You're not doing anything wrong, you just can't change the camera dimensions - they match the game size at the moment.
and then in 2015 on the same thread:
So you can tell if something is within the camera bounds or not. Which is impossible if the camera doesn't have a size.
suggesting that things haven't changed since 2013, and the camera doesn't resize as you're expecting.
Testing as well suggests that things haven't changed either.
Ok so I have been working with a designer who made the mockup of app in Photoshop. I am not using iPhone statusbar and using custom navigation bar which the designer made of 100px. In that navigation he put an icon of 48 pixels.
Now I have to transform into code and I am using UIWebView for the purpose. The layout he designed, I am going to make it in HTML/CSS that will be loaded in UIWebView.
Now the issue is, the PSD he made for the screen has SIZE of 640 x 960. In Iphone4 it's resolution rather than Physical Size. Base on setting of 640 x 960 pixel Image/PSD, he made the top bar of 100pixels. Now If I follow him that things getting messed up.
What I did that I just made everything half of size to accomodate 320 x 480 sceen size in CSS. I set Navigation Bar to 50px(for 320 x 480) and I put #2x.png image (48 x 48) in it.
Now when I load app in my mobile it appears big as it should which gives me impression that 48 pixels did not appear as 24px Image with High Density.
I am quite confused, If I make 100px navigation bar then everything looks big as I am targetting big size while I have to target high resolution. How do I adjust elements(DIV) and Images in my scenario?
Take a look at these articles on using CSS3 media queries and the viewport tag in order to help manage styles between normal and high definition displays:
Targeting the iPhone 4 Retina Display with CSS3 media queries
iPhone 4 and iOS 4 Safari Detection and Behavior
I've got a tablet Galaxy tab gt-p5110 and I'm trying to adopt photoshop design. This tablet has a 1280 x 800 resolution and my photoshop design has the same resolution as well. However, when I transfer images photoshop on Android layout everything seems to be compressed and smaller. It simply doesn't actually look like in photoshop design.
What am I missing here ? Resolution is the same.
Mabye you have different color profiles in use?
So I have two images set to fill the screen - one at 320x480 (iPhone 3) and the other at 640x960 (iPhone 4).
img.png (320x480)
img#2x.png (640x960)
In Interface Builder, I have img.png set to fill the view (it shouldn't be filling the iPhone 4 view, though, right?), and when I build and run, it is notably too small.
So, when I do the opposite, setting img#2x.png as the img, a giant blue question mark fills the view. The project still builds and the image fills the screen, but is very pixelated as if it has been rescaled. It shouldn't have been rescaled, though, as it is the higher resolution.
Now using...
img.png (640x960)
img#2x.png (320x480)
I've also tried switching which file takes the #2x suffix, but that has not helped either. With the smaller file taking the #2x suffix, and setting the image view to img.png, it shows up way larger than the view canvas, but way too small when on the phone. With the smaller file still having the #2x suffix, I tried switching the view to the new img#2x.png and once again got the oversized, pixelated question mark in IB and a low res full-screen image when deployed to the phone.
I also made sure that my view size was set to 640x960 in the size inspector. What else should I be doing?
Don't use #2x when specifying the image name. Just use the base name of the image (so in your case, just img). iOS will do the magic behind the scenes to use the 2x version if it's on a retina display and the regular version otherwise (including when you use a xib to lay out your interface).
The displayed dimensions of the image will always be the dimensions of the non-2x image. The retina display just displays 2 pixels for every 1 which is why the scale is 2.0 and you have to double the dimensions of the original image. So your view size in IB should be 320x480.
Edit
If IB is being finicky, especially in Xcode 4, just try deleting the xib and starting over. Sometimes it gets a bit corrupted and doesn't know what to do with itself. I've had to do this on one or two occasions, and it seems that it worked for the OP as well.