0

我需要把頂部欄放在「抽屜導航」之外。頂部酒吧如何隱藏在android棒棒糖?

enter image description here

在我的奇巧設備,它看起來不錯。但在棒棒糖上進行測試時會出現這樣的問題。

不知道如何刪除它,我試圖改變活動的主題爲「NoActionBar」和類似的聖誕節。但它不起作用。

謝謝。

我正在做這個設計。 kitkat看起來不錯。

lolipop但如果你看到那個酒吧。 enter image description here

這是我的主要活動:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.like.mail.network.aupa.maillike.TestActivity"> 

    <include 
     layout="@layout/top_toolbar" /> 

    <include layout="@layout/content_test" /> 

</LinearLayout> 

這是我content_test:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:openDrawer="start"> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <include 
      layout="@layout/app_bar_main" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 

    </LinearLayout> 

    <android.support.design.widget.NavigationView 
     android:id="@+id/nav_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="left" 
     android:fitsSystemWindows="true"> 

     <ExpandableListView 
      android:id="@+id/navigationmenu" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="#222" 
      android:groupIndicator="@null" 
      android:listSelector="#D84B20"> 
     </ExpandableListView> 

    </android.support.design.widget.NavigationView> 

</android.support.v4.widget.DrawerLayout> 

這是我的清單:

<activity 
     android:name=".TestActivity" 
     android:label="@string/title_activity_test" 
     android:theme="@style/AppThemeWithoutActionBarTitle"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

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

這是我的風格:

<style name="AppThemeWithoutActionBarTitle" parent="AppTheme"> 
    <item name="android:actionBarStyle" tools:targetApi="honeycomb"> 
     @style/ActionBarWithoutTitle 
    </item> 
</style> 

<style name="ActionBarWithoutTitle" parent="@style/ActionBar"> 
    <item name="android:displayOptions" tools:targetApi="honeycomb">useLogo</item> 
</style> 
+0

您是否嘗試將其設置爲全屏模式? – Gorio

+0

是的。全屏看起來不錯。但是當屏幕被拿出吧檯電話(顯示堆疊,通知等)並且覆蓋我的「頂級酒吧」的一些元素。 我也想在正常模式下使用它。這個問題有沒有解析? 我錯了構造我的代碼嗎? –

回答

1

嘗試在清單

<activity 
    android:name=".TestActivity" 
    android:label="@string/title_activity_test" 
    android:theme="@style/AppThemeWithoutActionBarTitle"> 
    <intent-filter> 
     <action android:name="android.intent.action.MAIN" /> 

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

RES /值-V21/style.xml

<resources> 

<style name="AppThemeWithoutActionBarTitle" parent="Base.MyTheme"></style> 

<style name="Base.MyTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
    <item name="windowActionBar">false</item> 
    <item name="windowActionBarOverlay">false</item> 
    <item name="android:windowFullscreen">true</item> 
    <item name="windowNoTitle">true</item> 
</style> 

</resources> 
+0

以此成就隱藏吧。但是當屏幕被處理時,手機的頂部欄(電池,通知等)被安裝在我的應用程序的某些元素上。 –

+0

@VipPunkJoshersDroopy嘗試這個新的解決方案。將stryle.xml添加到values-v21文件夾中。 – Gorio

+0

我正在嘗試.. 對不起,我是新的。 該樣式也應該放在「style.xml」中。 除了添加「值-21」的樣式,我刪除了你在「值」中的位置並放置了它? –

0

完成用下面的代碼移動欄:

super.onCreate(savedInstanceState); 
getWindow().requestFeature(Window.FEATURE_NO_TITLE); 
setContentView(R.layout.activity_test); 

同時刪除屬性:和roid:fitsSystemWindows =「true」所有「佈局包括」並將其放在主要位置。