开发者

Fullscreen activity w/Webview still shows status bar at top

I have a simple Android app that targets Android 1.5 or above. I have an activity that is set to use the theme below (set in the manifest).

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

Within the activity, I have a WebView (see full XML:)

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

    <WebView 
        android:id="@+id/webview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

</LinearLayout>

I believe I have my onCreate code setup to properly handle urlLoading (see below). In the emulator when I test this code, the status bar does no display at the top. On my target device which is an Archos 7 home tablet running Android 1.5 with a screen resolution of 800 x 480, the app runs, but the status bar appears at the top.

Any idea why this might be happening?

FULL SOURCE OF THE main activity:

package com.bri.RestaurantLauncher;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class RestaurantLauncherMain extends Activity {

    private class RestaurantLauncherMainWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return false;
        }
    } 

    WebView webview;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
        requestWindowFeature开发者_StackOverflow社区(Window.FEATURE_NO_TITLE);

        setContentView(R.layout.main);

        this.webview = (WebView) findViewById(R.id.webview);
        webview.setWebViewClient(new RestaurantLauncherMainWebViewClient());
        this.webview.getSettings().setJavaScriptEnabled(true);
        this.webview.loadUrl("http://www.google.com");
    }
}


Any idea why this might be happening?

If I had to guess, it is tied to this:

On my target device which is an Archos 7 home tablet...

Tactically, the ARCHOS 7 tablet appears to work like the ARCHOS 5, with the HOME, BACK, and MENU buttons on the status bar. In that case, the ARCHOS riff on Android may not support full-screen mode, because then the user could not leave the app. You might try some existing open source projects known to support full-screen mode and see how they behave. For example, my vidtry sample app plays back streaming video full-screen.

Strategically, always ensure that your primary test device has the Android Market installed. Devices that have the Market must pass compatibility checks, other devices do not. Now, if you want to have a non-Market device just for some light testing, that's cool, but you will want some other Market-enabled Android device to see what the experience will be like for the vast majority of Android users.


Thanks. I'm still looking around for a way to do this. Some apps that come with the device (video) do hide the status bat, but at least so far, I haven't been able to do so. I'm not looking to build a consumer app for end users, so Market access isn't that important at this point. The ultimate app would be sold together with the hardware as a turnkey solution. If I can't get it to work on the Archos 7 I'll have to resort to an imported no brand Chinese device. I'd rather not do that due to the additional expense involved. The Archos seems to be well made, has good battery life and a decent touchscreen for my needs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜