Looking for a way to build resolution independent layout xml?

by Avraham Serour » Fri, 06 Mar 2009 02:57:51 GMT


Sponsored Links
 build the interface without the xml, coding it, so each time you are going
to draw it check current resolution.
I worked with brew a few years back and some things we did that way, others
we just draw the button the same size in pixels, so the owner of the bigger
screen would see things smaller or had more unused screen area





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



Looking for a way to build resolution independent layout xml?

by Romain Guy » Fri, 06 Mar 2009 08:01:03 GMT


 No, that is NOT the correct way to do it.

The XML layout files contain everything you need to easily support
different screen densities. First of all, define all dimensions using
fill_parent/wrap_content or the dip unit. For instance, instead of
layout_width="10px" use "10dip". Also, you can create resource
directories that are configuration dependent: drawable-320x240/ or
drawable-120dpi/.

The current versions of Android (1.0 and 1.1) let you use these
features but they are not interpreted correctly. Cupcake however
correctly transforms the dip unit into pixels and lets you use the
XXXdpi resource directories.







-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

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


Sponsored Links


Looking for a way to build resolution independent layout xml?

by Dianne Hackborn » Fri, 06 Mar 2009 08:12:38 GMT


 




But Cupcake does -not- introduce platform support for anything besides HVGA;
official support will be coming after Cupcake.  This is just another step on
the road to getting there.

Just to be clear. :)

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

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



Looking for a way to build resolution independent layout xml?

by Dianne Hackborn » Fri, 06 Mar 2009 08:13:47 GMT


 Oh and it's probably worth saying, definitely before cupcake it just isn't
worth trying to run the emulator in anything besides the normal HVGA
resolution.  No other resolutions are supported, and trying to make them
work is really just going to be sending you off in the wrong direction
working around things in the platform that just aren't there.








-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

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



Looking for a way to build resolution independent layout xml?

by Romain Guy » Fri, 06 Mar 2009 08:16:54 GMT


 Yes, that's correct I should have been clear about that, sorry.








-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

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



Other Threads

1. Question about requestLocationUpdates()...

I have two questions regarding this call:

1. After making this call, does it update the current location then
call the listener you give it? In other words, does it actually wait
to complete the location update, store the location in
"lastknownlocation", then call your location listener?

2. If you give this call a "min time" as one of the arguments(instead
of 0), will it automatically make locations updates using the time
given then call your listener OR does providing a time just mean that
it will only respond to a call after the min time has expired and
won't process anything before it?

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

2. some questions about WebView with loading external url

when I load external web page, image or javascript file from local
webpage.
I can't see external image and can't load javascript or webpage.
but I can only see local image.
why I can't load external javascript, webpage or image?

here is the HTML source.
(of course, I filled right [daum open API key])

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Daum ÔéČAPI</title>
<script type="text/javascript" src="http://apis.daum.net/maps/maps.js?
apikey=[daum open API key]" charset="utf-8"></script>
</head>
<body>
        <div id="map" style="width:600px;height:400px;" style="border:1px
solid #000"></div>
        <img src="http://4.bp.blogspot.com/_2-7AdSkZA7I/RlCnDhD3ZfI/
AAAAAAAAE9U/LEHMtyVLdY8/s400/CutyTale10.jpg">
        <img src="file:///android_asset/coffeebean.jpg">
        <script type="text/javascript">
                var map = new DMap("map", {point:new DLatLng(37.48879895934866,
127.03130020103005), level:2} );
        </script>
        <iframe src="http://www.daum.com" width="300" height="150"></iframe>
</body>
</html>

and I use this Activity source

package bo.my.android.test;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;

public class OpenAPITest extends Activity {

        WebView webView;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        webView = (WebView) findViewById(R.id.webView1);
        webView.setWebViewClient(new DaumMapClient());
        webView.getSettings().setJavaScriptEnabled(true);

        webView.loadUrl("file:///android_asset/daummap.html");
        //webView.loadUrl("http://www.daum.net");
    }
}

I check permission like this manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="bo.my.android.test"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <activity android:name=".OpenAPITest"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-permission android:name="android.permission.INTERNET"></uses-
permission>
    <uses-sdk android:minSdkVersion="2" />

</manifest>


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

3. Opening soft keyboard on focus change.

4. Focus control

5. Connecting to a Mysql database or ther on an android app

6. Errors while loading classfiles from groovy

7. some questions about WebView with loading external url