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. How to set clickable areas of a single image?

Hi All

I have one image (it's a guitar fretboard), and I want to identify/act
on touch of events when different parts of the image are touched/
selected.

I can set the whole image to be clickable with setClickOnListener of
ImageView.

Is there a way to either:

1. Identify the coordinates of which point has been touched?
2. Define sub areas on the image and setClickOnListener for those
areas?

Otherwise, I'm thinking I must implement a GridView and dissect my
image into individual images and arrange them so they look like one
large image.

Thanks for any help!
Chris

--~--~---------~--~----~------------~-------~--~----~

2. Async thread aborted after catching (all?) exceptions

I have the following code...

        @Override
        protected Void doInBackground(Void... unused) {
                Log.i(TAG, "invoking background thread");

                        try {
                                mClient.get("http://thishostdoesntexist");
                        } catch (RuntimeException e) {
                                mActivity.onTaskError(e.getMessage());
                        } catch (HttpResponseException e) {
                                mActivity.onTaskError(e.getMessage());
                        } catch (ClientProtocolException e) {
                                mActivity.onTaskError(e.getMessage());
                        } catch (UnknownHostException e) {
                                mActivity.onTaskError(e.getMessage());
                        } catch (IOException e) {
                                mActivity.onTaskError(e.getMessage());
                        }

                Log.i(TAG, "exiting background thread");
                return null;
        }

My mClient get method is a simple HttpClient execute with an output
buffer to read the input stream, so it's very trivial. Everytime I
execute this task UnknownHostException will be triggered which will in
turn call onTaskError on my currect Activity, but I still get a
RuntimeException, but I don't see why. Maybe it's because it's late
and i've done about 12 hours of writing code so it's something simple
I just can't see?

What should I be looking for?

Thanks in advance

-- 

3. "Discard" button in Compose screen of Google Mail

4. schemas.android.com site down?

5. Analytics for Android Apps - issue getting the SDK

6. Market update, showing horizontal icon list for apps per group

7. How native Gallery is reading bigger images!