0

I was testing my app on a 3.6" screen with 480 x 850 pixels. It was working fine and all images show up.

I deployed it, and got a email from a friend saying that roughly 20% of the app gets cut down from the bottom. She is using 3.7" screen with 320 x 480 pixels.

Is there a fix for this? I thought that Android stretches everything for proportions.

I am only using hdpi folder in my app.

Alexey
  • 3,607
  • 8
  • 34
  • 54
  • in your layout use scroll view if you are using single Layout and single Drawable folders – Usman Kurd Jul 25 '13 at 17:58
  • That's a weird workaround. I want to the user to see everything that is on the screen at a certain time. – Alexey Jul 25 '13 at 18:05
  • That's not a weird work-around. That's the proper way of doing it. Otherwise you should be writing your app in such a way that it scales to a single-screen of view. You can lay things out on the screen based on % of the screen using a LinearLayout and Weights. Obviously if that was the case, your outermost layout should be set to layout_width and layout_height of match_parent. Then everything would be taken care of with no Scrolling. But again, Scrolling is the way apps were meant to be built. – spierce7 Jul 25 '13 at 18:41

3 Answers3

2

You have to use mdpi,hdpi and ldpi folder for images.. Android app take it self as its resolution, so use three of them, If you want to support your app in all device thn you should also use layout/large,layout/medium,layout/xlarge,layout/small.

for more Information refere this link

for that you have to make some changes in your menifest file also e.g

 <supports-screens android:resizeable=["true"| "false"]
                      android:smallScreens=["true" | "false"]
                      android:normalScreens=["true" | "false"]
                      android:largeScreens=["true" | "false"]
                      android:xlargeScreens=["true" | "false"]
                      android:anyDensity=["true" | "false"]
                      android:requiresSmallestWidthDp="integer"
                      android:compatibleWidthLimitDp="integer"
                      android:largestWidthLimitDp="integer"/>

for that refer this link

Mit Bhatt
  • 1,605
  • 2
  • 13
  • 24
1
<supports-screens android:smallScreens="true" 
          android:normalScreens="true" 
          android:largeScreens="true"
          android:xlargeScreens="true"
          android:anyDensity="true" />

Add this to your manifest file of app.

Looking Forward
  • 3,579
  • 8
  • 45
  • 65
1

Android won't stretch the actual screen. It will stretch images under certain circumstances, but that doesn't sound like it's your problem.

First, I'd highly recommend you get the proper size images for at least mdpi, hdpi, and xhdpi. mdpi is drawn with the standard 72 resolution, and then comparatively hdpi is 1.5X mdpi, and xhdpi is 2.0X mdpi.

Second, if you program your screen components correctly you are using Density Independant Pixels (dip, or dp), and text is sized with sp. This means that no matter what size screen you are on, something shows as the same size. So there isn't scaling that's happening, but rather, Android is keeping the same scale (this is very good). This means that on some screens your app will show on the entire screen, and on other smaller screen devices, it can only show a portion of your screen. This sounds like what is going on. You need the ability to SCROLL your content, so in your main layout file, put the child as a ScrollView. This is the correct way to handle your issue.

Edit: You could fix this the way that the other 2 posters I see are saying, as in saying you support any-density so the screen scales, but this isn't the proper way of doing things. You want your content to be scrollable, lest you end up with very small-unreadable text on small screens, or giant unweildy text on big screens. You want your content to be the same size in physical space no matter what device it's displayed on, which is why Android uses dp's.

Edit2: You could design your screen allotting percents of the screen to different components. The way you do that in Android is using the LinearLayout. The linear layout has a weight sum attribute. If you set the weight sum to 100, you can then set the childrens weights to the percent you want it to take up the screen. So if you wanted to give the bottom view 20% of the screen, in a LinearLayout with orientation vertical, you'd set the first view's weight to 80 (taking up 80% of the screen), and the bottom to 20. Make sense?

spierce7
  • 14,797
  • 13
  • 65
  • 106
  • I am using sp and dip and dp everywhere. It is a trivia game, timed, so I prefer the user does not have to scroll – Alexey Aug 05 '13 at 02:07
  • @Alexey Ah, you are making a game. That's a completely different story. I highly recommend you take a look at another question I answered to someone with a similar problem. I'd recommend the same advice. http://stackoverflow.com/questions/17936574/compatibility-of-android-screens/17936893#17936893 , however in your case since your game is so text heavy it might not be best. I'll edit my answer to give you another route. – spierce7 Aug 06 '13 at 03:30