2015-04-02 28 views
0

我style.xml文件無法刪除我的動作條陰影

<style name="AppBaseTheme" parent="Theme.AppCompat.Light"> 
     <item name="windowActionBar">false</item> 
    </style> 

    <style name="AppTheme" parent="AppBaseTheme"> 
     <item name="actionOverflowMenuStyle">@style/OverflowMenu</item> 
     <item name="elevation">0dp</item> 
     <item name="android:windowContentOverlay">@null</item> 
    </style> 

    <style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow"> 

     <!-- Required for pre-Lollipop. --> 
     <item name="overlapAnchor">false</item> 

     <!-- Required for Lollipop. --> 
     <!-- <item name="android:overlapAnchor">false</item> --> 
    </style> 

    <style name="ProgressBarStyle" parent="@android:style/Widget.ProgressBar.Horizontal" /> 
    <!-- the theme applied to the application or activity --> 


</resources> 

我的清單

<application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
</application> 

我使用操作欄V7緊湊支持庫。我無法刪除我的動作欄陰影。

回答

0
public void forceTabs() { 
      try { 
       Method setHasEmbeddedTabsMethod = actionBar.getClass() 
        .getDeclaredMethod("setHasEmbeddedTabs", boolean.class); 
       setHasEmbeddedTabsMethod.setAccessible(true); 
       setHasEmbeddedTabsMethod.invoke(actionBar, true); 
      } 
      catch(final Exception e) { 
       // Handle issues as needed: log, warn user, fallback etc 
       // This error is safe to ignore, standard tabs will appear. 
      } 
     } 

在你的oncreate方法中調用這個方法。