0

我是 android 开发的新手,但是在搜索了一段时间后,我无法在我的 android 窗口中找到最大化我的 webview 的解决方案(在我当前的测试中为 12080*800)。物理设备上出现同样的问题(三星 10.1)

https://dl.dropbox.com/s/d57nmlhbs8pu6k7/2013-06-11%20at%2010.18.15.png

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="top"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <WebView
        android:id="@+id/webView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentTop="true"
        android:layout_margin="0dp"
        android:padding="0dp"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />

</RelativeLayout>

和我的代码:

@Override
protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

//Remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);

//Remove notification bar and set fullscreen
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);

// add the webview
WebView www = (WebView) findViewById(R.id.webView);
www.setWebViewClient(new WebViewClient());
www.getSettings().setJavaScriptEnabled(true);
www.getSettings().setDomStorageEnabled(true);
www.getSettings().setSavePassword(false);
www.getSettings().setSaveFormData(false);
www.getSettings().setUseWideViewPort(true);

// load html
www.loadUrl("http://192.168.1.8:3000/app/tgg4yme");

}

我也尝试过通过编辑器填充窗口...没有成功

谢谢

4

0 回答 0