gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:33:24 27 4
gpt4 key购买 nike

我正在尝试构建一个全屏应用程序,当我在 Acer Iconia 8 中运行它时,标题没有显示,但操作按钮仍然出现:

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

和样式:

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

编辑:

主要 Activity 类:

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()));
}
}

我已经添加了类 MainActivity 代码来完成问题。

最佳答案

样式.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>

list 文件

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

关于android - Theme.AppCompat.Light.NoActionBar.FullScreen 不适用于 Android 4.4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32727527/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com