I think this may help rescale for any screen.
http://uihacker.blogspot.com/2011/01/android-phonegap-scale-webview-to-fit.html
use this in your index.html :
<meta name="viewport" content="target-densitydpi=device-dpi" />
change your app.java to this
//*********************************************************
import com.phonegap.*;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.webkit.WebSettings.RenderPriority;
import android.view.WindowManager;
import android.content.Context;
public class App extends DroidGap {
// declare the original size of the iPad app
protected float ORIG_APP_W = 480;
protected float ORIG_APP_H = 800;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
// set some defaults
this.appView.setBackgroundColor(0x000000);
this.appView.setHorizontalScrollBarEnabled(false);
this.appView.setHorizontalScrollbarOverlay(false);
this.appView.setVerticalScrollBarEnabled(false);
this.appView.setVerticalScrollbarOverlay(false);
// get actual screen size
Display display = ((WindowManager)
getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
// calculate target scale (only dealing with portrait
orientation)
double globalScale = Math.ceil( ( width / ORIG_APP_W ) * 100 );
// make sure we're all good
Log.v( "ORIG_APP_W", " = " + ORIG_APP_W );
Log.v( "ORIG_APP_H", " = " + ORIG_APP_H );
Log.v( "width", " = " + width );
Log.v( "this.appView.getMeasuredHeight()", " = " + height );
Log.v( "globalScale", " = " + globalScale );
Log.v( "this.appView.getScale()", "index=" +
this.appView.getScale() );
// set some defaults on the web view
this.appView.getSettings().setBuiltInZoomControls( false );
this.appView.getSettings().setSupportZoom( false );
this.appView.getSettings().setGeolocationEnabled( true );
this.appView.getSettings().setLightTouchEnabled( true );
this.appView.getSettings().setRenderPriority( RenderPriority.HIGH );
// set the scale
this.appView.setInitialScale( (int)globalScale );
}
}
///***********************************************************
On Jan 15, 5:56 pm, Steve Dossick <
sdoss...@gmail.com> wrote:
> Hi Garry
>
> I've not yet worked with DroidGap but the very best explanation I've found
> of how viewport settings are used in Android (and iPhone) is onhttp://
d.android.com/guide/webapps/index.html, specifically the subsection
> on Targeting Screens from Web Apps.
>
> -s
>
> On Sat, Jan 15, 2011 at 8:02 AM, Garry Taylor <
taylor.ga...@gmail.com>wrote:
>
> > Has anyone been able to answer this? I too am struggling with pinch/zoom on
> > Android, I really need to be able to turn it off, but nothing seems to work.
>
> > I have tried
>
> > <meta content='width=device-width; initial-scale=1.0; maximum-scale=1.0;
> > user-scalable=0;' name='viewport' />
> > <meta name="viewport" content="width=device-width" />
>
> > This locks the zoom (great!), but locks it at a nasty scaled in view (not
> > great!). I tried to changed the scales, but it did not seem to make any
> > difference.
>
> > I assume just about everyone making an actual app rather than the web page
> > needs this work, so I guess it can be done somehow.
>
> > Any thoughts?
>
> > Garry
>
> >>
phonegap+u...@googlegroups.com<
phonegap%2Bunsu...@googlegroups.com>
> >
phonegap+u...@googlegroups.com<
phonegap%2Bunsu...@googlegroups.com>