android - 我需要删除特定 Activity 中的顶部应用栏

标签 android kotlin android-fragments

我是android、Kotlin的初学者, 我不知道如何删除特定 Activity 和所有 Activity 中的顶部应用栏。 我有启动画面和新 Activity 下面是我的样式代码,我已经在 styles.xml 中导入了一个 Material 设计 不知道在styles.xml中去掉top app bar的方法是什么

<resources>
    <!-- Base application theme. -->

    <style name="AppTheme" parent="Theme.MaterialComponents">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

</resources>

Android list 文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.shanjostech.newsample">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".Main_Screen"></activity>
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

最佳答案

将主题属性添加到要在 list 文件中隐藏应用栏的 Activity

        <activity
            android:name="com.mvvm.Activity"
            android:label="@string/app_name"
            android:theme="@style/NewTheme">
        </activity>

然后在 style.xml 中创建一个新主题,父主题为 Theme.AppCompat.NoActionBar

 <style name="NewTheme" parent="Theme.AppCompat.NoActionBar">
    
   </style>

关于android - 我需要删除特定 Activity 中的顶部应用栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64780949/

相关文章:

java - 微调框已选择项目选择事件

android-studio - Android Studio Kotlin 编译器警告

android - ViewPager、FragmentStatePagerAdapter 和无限滚动

android - 如何在maven上发布一个库项目?

android - Android中的共享数据和多线程

java - LibGDX:Kotlin 与 Java

android - 嵌套保留的 FragmentTabHost 不会将选项卡附加到新 Activity

android-fragments - nestedscrollview 内 RecyclerView 的 onBindViewHolder 立即为所有项目调用

java - 如何在phonegap android中隐藏地址栏

android - 使复合控件从父布局中删除自身