简体   繁体   English

Theme.AppCompat.Light.NoActionBar.FullScreen不适用于Android 4.4

[英]Theme.AppCompat.Light.NoActionBar.FullScreen Not Working with Android 4.4

I am trying to build a fullscreen app and when I run it in a Acer Iconia 8, The title don't show up but the action buttons still appear: 我正在尝试构建一个全屏应用程序,当我在Acer Iconia 8中运行它时,标题不显示但操作按钮仍然显示:

AndroidManifest.xml AndroidManifest.xml中

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen">
    <activity
        android:name=".MainActivity"
        android:windowSoftInputMode="adjustResize"
        android:configChanges="orientation|keyboardHidden">

        <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" />

And Styles: 和风格:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>

    <style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
       <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowContentOverlay">@null</item>
    </style>

</resources>

EDIT: 编辑:

Main Activity Class: 主要活动类别:

public class MainActivity extends AppCompatActivity {

    private Context context;

    private WebView webView;
    private LoginDialog dialog;
    private PinDialog pin;
    private RelativeLayout mainLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        context = this;

        ClientCredentials.loadCredentials(context);

        mainLayout = (RelativeLayout)findViewById(R.id.mainLayout);
        Button loginButton = (Button)findViewById(R.id.loginButton);
        webView = (WebView)findViewById(R.id.webview);
        dialog = new LoginDialog(context);
        pin = new PinDialog(context, dialog);

        loginButton.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                if(ClientCredentials.getClientId() > 0 && ClientCredentials.getToken().equals("")) {
                    dialog.show();
                }
                else {
                    pin.show();
                }

                return false;
            }
        });

        pin.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                loadUrl();
            }
        });

        dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                loadUrl();
            }
        });

        webView.setWebChromeClient(new WebChromeClient());
        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true);

        if(ClientCredentials.getClientId() > 0 || !ClientCredentials.getToken().equals("")) {
            loadUrl();
        }
        else {
            dialog.show();
        }
    }

    private void loadUrl() {
        webView.loadUrl(String.format("http://XXX?Address_Id=%d&Token=%s", ClientCredentials.getClientId(), ClientCredentials.getToken()));
    }
}

I have added the class MainActivity code to complete the question. 我已经添加了类MainActivity代码来完成问题。

styles.xml styles.xml

<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowActionBar">false</item>
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowContentOverlay">@null</item>
</style>

Manifest file 清单文件

android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"

I had this issue before. 我以前遇到过这个问题。 As far as I can remember, I had to make it go fullscreen programatically: 据我所知,我必须以编程方式全屏显示:

https://developer.android.com/training/system-ui/immersive.html https://developer.android.com/training/system-ui/immersive.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ActionBar 始终与 Theme.AppCompat.Light.NoActionBar.FullScreen 一起显示 - ActionBar is always shown with Theme.AppCompat.Light.NoActionBar.FullScreen Theme.AppCompat.Light.NoActionBar 在迁移到 androidx 后不起作用 - Theme.AppCompat.Light.NoActionBar not working after migrating to androidx 在 Android Studio 上找不到 Theme.AppCompat.Light.NoActionBar - Theme.AppCompat.Light.NoActionBar not found on Android Studio Android Theme.AppCompat.Light.NoActionBar无法解析 - Android Theme.AppCompat.Light.NoActionBar can not be resolved Theme.AppCompat.Light.NoActionBar的父级 - Parent of Theme.AppCompat.Light.NoActionBar 将 Theme.MaterialComponents.DayNight.DarkActionBar 更改为 Theme.AppCompat.Light.NoActionBar 后应用程序无法正常工作 - App not working after changing Theme.MaterialComponents.DayNight.DarkActionBar to Theme.AppCompat.Light.NoActionBar Lollipop +设备中的Android主题Theme.AppCompat.Light.NoActionBar的奇怪行为 - Strange behavior of android theme Theme.AppCompat.Light.NoActionBar in Lollipop+ devices 在哪里获取Theme.AppCompat.Light.NoActionBar文档以及如何为Android全局修改样式? - Where to get Theme.AppCompat.Light.NoActionBar document and how to modify styles globally for android? 无法解析符号Theme.AppCompat.Light.NoActionBar - Cannot resolve symbol Theme.AppCompat.Light.NoActionBar Unity 说资源样式/Theme.AppCompat.Light.NoActionBar not found - Unity says resource style/Theme.AppCompat.Light.NoActionBar not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM