My app scales vertically and cuts off right and left edges. How can I achieve the opposite? For example I have 16:9 portrait image. When I launch it on 16:10 screen in portrait orientation, it should fit horizontally and cut upper and lower edges off. Can I achieve that changing Manifest file? Thanks!
Related
My 2D project uses a 1:1 ratio to accommodate Portrait or Landscape. Stretch Mode is "viewport" and Aspect is "expand" to fit any device.
The GreenScreen Node fills that 1:1 space, so I reposition GrayButtons based on device orientation.
Both nodes are children of a Control anchored to Center Top:
Portrait works on all devices, and most devices handle Landscape correctly:
The GreenScreen automatically centers itself in the Center Top as desired for either rotation:
However on only some Android devices, it won't center. It aligns GreenScreen to the top left corner so half the buttons are offscreen:
How can I always center the game on any device?
In researching android image sizes for different sized screens/densities etc., I've found an absolute tonne of things, a lot of which may be deprecated, and a lot of which may not be relevant to my situation, so I thought I'd ask for general advice.
My basic question is how big should I make my background image in pixels, or inches or centimetres? Probably pixels would be best.
My app is in locked in landscape mode, I don't need to worry about orientation.
I'm using a vector image, so I don't need to worry about scaling and quality issues
So, I want my background image to fit onto a ten inch tablet, so that it fills the whole screen with no scrolling.
On phones, I want the height(which would be the width in portrait mode) to match the height of the screen, and my image will be in a horizontal scroll view, so scrolls left and right in landscape mode.
So, do I need to do the whole creating different image resources for different dpi's thing, or will one do? What size should I make it?
I will also be lining up textviews with specific parts of the image, so presumably I'll need different layouts, as the lining up of textviews relative to the image will probably vary from screen size to screen size, resolution to resolution,bigger textviews for bigger screens etc. How do I implement this?
Thanks
Vector images should be used for icons only. In your case i'd just use a drawable & make sure you have different images for the different densities. Then create different layouts for phone and tablet. You should use a scrollview on the layout for the phone
The google pixel is a good representation of an android phone: It has a 1080 x 1920 resolution at 441 dpi. Then from the the android developer docs:
xxhdpi ~ 480dpi
you can scale the 1080 x 1920 down by the (3:4:6:8:12) ratios. if you image
has a different aspect ratio make sure that that the width or the height matches with 1080 x 1920 depending on the orientation of the device
I am a webdeveloper, and I am very lost in all the Android screen settings for aligning content. I've seen weight, gravity, scaletypes of the image etc. etc.)
I hope I can make my intentions clear, and that it's possible to fullfill them.
In this picture of a phone screen, I have 2 square pictures (the purple and the green one).
What I want to accomplish is that the width of the pictures always take up 50% of the screen width, and that it is centered (so the margin left and margin right is 25%).
So let's say you have a 600*800 screen, the width should be 300 pixels and the margin left and right would be 150 pixels (or better 25%). On a 768*1024 screen the width should be 384 pixels.
The height should follow that size (I've tried a lot of code, and the best result was that the width was sort of a pertentage, with 3 relative layouts in a lineair layout, but then only the width was correct, but the height wasn't)
Depending on your screen size it could be that the height of the two images together would be higher than the screen and a scrollbar would be neccessary)
Wrap them in PercentRelativeLayout and fix their width 50%. set their height equal to their width in Java when the view gets populated
I want to show a fixed 640x640px image on the screen and below that image 2 images that are fixed sized for 128x128px.
In graphical layout, the default(?) width is 320px and height is around 460px so I can't do what I want. I know I should support different screen sizes but for now I want to work with my minimum requirements and then change things according to the screen sizes. How can I "force" the graphical layout to be 640x640 or other standard size which is around that size?
Thanks
640*640 is no standard size (no device, as far as I know has a square aspect ratio).
You can emulate a device with a bigger screen size, such as 1280dp by 800dp (WXGA).
By the way, you can't "force" a layout to be bigger than the screen size.
My screen size is 600px * 800px.
I created some wallpapers whose sizes are 600px * 800px or width:height=3:4,
when they were set as wallpaper, they got stretched, so the lower and right part couldn't be seen.
Does anybody how to solve this problem to make my wallpapers fit to the screen?
Android crops a part of your wallpaper so that when you swipe left and right, the background scrolls with it. For more information see this link or this link