如何从活动中删除操作栏

dev*_*v90 0 android android-appcompat android-layout android-fragments android-activity

我正在尝试从活动中删除操作栏.

我已经完成了以下操作,但它仍然将Action栏保留在我的Activity上

public class MyActivity extends AppCompatActivity{ .. }
Run Code Online (Sandbox Code Playgroud)

布局

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".TM.TMActivity"
    style="@style/AppTheme.NoActionBar"
    >


    <FrameLayout
        android:id="@+id/frame_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        style="@style/AppTheme.NoActionBar"
        />

</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

Style.xml

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>
Run Code Online (Sandbox Code Playgroud)

N J*_*N J 6

Theme.AppCompat.Light.NoActionBar它为我工作

例如

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->

</style>
Run Code Online (Sandbox Code Playgroud)