2014-10-11 2 views
6

У меня есть активность с фрагментом. Из этого фрагмента я вызываю метод, чтобы показать панель контекстного действия, и вот моя проблема.Прозрачная панель состояния действует Режим действия на Kitkat

Стили:

<style name="MyThemeLight" parent="@android:style/Theme.Holo.Light.NoActionBar"> 
    <item name="android:actionModeCloseButtonStyle">@style/MyCloseButton</item> 
    <item name="android:actionModeStyle">@style/ContextualBar.Light</item> 
    <item name="android:actionOverflowButtonStyle">@style/OverFlow</item> 
    <item name="android:actionBarStyle">@style/MyMainActionBar</item> 
    <item name="android:windowTranslucentStatus">true</item> 
    <item name="android:actionModeCloseDrawable">@drawable/close_white</item> 
    <item name="android:windowActionModeOverlay">true</item> 
    <item name="android:windowBackground">@color/background</item> 
    <item name="android:dropDownListViewStyle">@style/PopupMenuLight</item> 
</style> 

<style name="MyMainActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse"> 
    <item name="android:background">@drawable/ab_bottom_solid_dark_holo</item> 
    <item name="android:height">1dp</item> </style> 


<style name="ContextualBar.Light" parent="android:style/Widget.Holo.ActionMode"> 
    <item name="android:background">@drawable/ab_bottom_solid_dark_holo</item> 
    <item name="android:height">56dp</item>  </style> 

<style name="OverFlow" parent="@android:style/Widget.Holo.ActionButton.Overflow"> 
<item name="android:src">@drawable/menu_white</item> </style> 

<style name="MyCloseButton" parent="android:style/Widget.ActionButton.CloseMode"> 
    <item name="android:textColor">#000000</item> </style>  
</resources> 

Планировка:

<FrameLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true"> 

<android.support.v4.widget.DrawerLayout 
    android:id="@+id/drawer_layoutright" 
    android:layout_width="fill_parent" 
    android:layout_height="match_parent"> 

<android.support.v4.widget.DrawerLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/drawer_layoutleft" 
    android:layout_width="fill_parent" 
    android:layout_height="match_parent"> 
    <!-- The main content view --> 
    <android.support.v4.view.ViewPager 
    android:id="@+android:id/viewpager" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    /> 
<!-- The navigation drawer --> 
<fragment 
    class="...BookmarksLeft" 
    android:id="@+id/drawer_listleft" 
    android:layout_width="306dp" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:choiceMode="singleChoice" 
    android:divider="@android:color/transparent" 
    android:dividerHeight="0dp" 
    android:tag="bookleft"/> 

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

<fragment 
    class="...BookmarksRight" 
    android:layout_width="306dp" 
    android:layout_height="match_parent" 
    android:layout_gravity="end" 
    android:choiceMode="singleChoice" 
    android:divider="@android:color/transparent" 
    android:dividerHeight="0dp" 
    android:tag="bookright"/> 
</android.support.v4.widget.DrawerLayout> 

</FrameLayout> 

Как вы можете видеть, основной стиль не имеет панель действий, строка состояния прозрачна, "андроид: windowActionModeOverlay" является истинным и «android: fitsSystemWindows» - это правда, но я получаю:

enter image description here

Есть ли способ передвинуть CAB?

+0

Вы нашли ответ для этого? Я сталкиваюсь с той же проблемой ... – tchap

ответ

0

Просто замените paddingTop и высота. Затем добавьте стиль actionMode в AppTheme.

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
    <item name="actionModeStyle">@style/CustomActionMode</item> 
</style> 

<style name="CustomActionMode" parent="@style/Widget.AppCompat.Light.ActionMode.Inverse"> 
    <item name="android:paddingTop">25dp</item> 
    <item name="height">80dp</item> 
    <item name="titleTextStyle">@style/Title</item>  
</style>