Thursday, May 9, 2013

[android help] android image size from web


For starters, you are going to want to set a scaleType (try "center_inside") in your xml definition of the ImageView.


If you provide some code (in particular your layout xml file) I might be able to be of more assistance.


Update


Now, this may not fully be your problem, but it is a piece of it. DP (or DPI, they are the same thing) adjust for the screen density (pixels per inch), not the screen size. That means that an image of 200dp x 200dp will be approximately the same size in inches on both screens, not the same percentage of the screen.


Specs: Atrix 960 × 540 (https://en.wikipedia.org/wiki/Motorola_Atrix_2#Features) Galaxy Ace 480 x 320 (https://en.wikipedia.org/wiki/Samsung_Galaxy_Ace)


Since the Atrix is hdpi, and hdpi is a 1.5 multiplier, 200dp will take up 300px in real pixels, or approximately 1/3 (300/960) of the screen as you point out.


On the mdpi Ace, the 200dp translates evenly to 200px, which should be closer to 1/2 the screen. However, with the addition of the actionbar taking up screen real estate, it may seem like more.


The best way to deal with very small screens like the ace... well, my normal solution is to not support them very well, at least not on my first pass, as they are pretty rare. But if you want to, the best way is to provide alternate layouts.


For Example:


Create a folder named layout-large (or similar, see: http://developer.android.com/guide/topics/resources/providing-resources.html#Compatibility).


Make a copy of your existing xml file in that folder. (name must be exactly the same)


Modify the file in layout/ so that it works better on smaller screens.


Essentially, if the device has a "large" screen or above (where large is basically the standard these days), it will use the layout in the layout-large/ folder.


Otherwise, it will use the default layout in the layout/ folder.


If you think this explanation is not what is happening, please provide screen shots to verify that the layout is in fact not behaving like it should.



.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...