Best way to scale for different screen resolutions/dimensions?

by powerdroid » Fri, 06 Aug 2010 11:58:14 GMT


Sponsored Links
 I have a class that extends LinearLayout and handles drawing to the
screen.  (it is in the early stages)  How would I go about determining
the dimensions of a screen and resizing the images, etc., that this
class is drawing to the screen on the fly before actually drawing them
to the screen?

What I'm trying to accomplish is support for devices that have varying
screen dimensions and resolutions from the same code base, with each
device being scaled properly..

Thank you for any pointers..

PD

--



Best way to scale for different screen resolutions/dimensions?

by TreKing » Fri, 06 Aug 2010 20:52:07 GMT


 



Tip: Search the official documentation and the group first, especially for
common problems like these.

 http://developer.android.com/guide/practices/screens_support.html 

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

--


Sponsored Links


Best way to scale for different screen resolutions/dimensions?

by Warren » Fri, 06 Aug 2010 21:04:32 GMT


 Check out onMeasure() and onLayout(). Those functions are called while
views are being positioned, etc.








--



Other Threads

1. Spinners identical in XML but look different when run



That has nothing to do with it.


That is determined by the adapters you put in the Spinners. The
adapters are responsible for the Views that go in the Spinners, both
for the selected item and for the available items in the dialog that
appears when the user presses the drop-arrow.


Use the same layouts in your adapters.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!

-- 

2. Detecting slow or unavailable network and black screen

You're doing the AsyncTask wrong. Replace your call to
doInBackGround() with execute():

    new downloadData().execute();

doInBackground is a callback. You shouldn't be calling it yourself.

Also, you probably want to use a ProgressIndicator to let the user
know you are working. You would do that in the AsyncTask method
onPreExecute() and remove it in onPostExecute.

Best regards,
Brian Cooley




-- 

3. android application error reports

4. OOT: Paging GilaOriginal

5. Detecting slow or unavailable network and black screen

6. Yahoo messenger update 1.0.2

7. Spinners identical in XML but look different when run