2017-10-17 53 views
1

我正在嘗試設置可繪製在我的活動圖像的ActionBar,使用@style,卻看不到任何結果... 這是我@styles:如何設置動作條圖像與@style

<resources> 
<!-- Base application theme. --> 
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <!-- Customize your theme here. --> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
    <item name="android:actionBarStyle">@style/MyActionBarTheme</item> 
</style> 

<style name="MyCustomTheme" parent="@android:style/Theme.Holo.Light"> 
    <item name="android:actionBarStyle">@style/MyActionBarTheme</item> 
</style> 

<style name="MyActionBarTheme" parent="@android:style/Widget.Holo.Light.ActionBar"> 
    <item name="android:background">@drawable/bgd</item> 
</style> 

這是我的活動代碼:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:app="http://schemas.android.com/apk/res-auto" 
      android:theme="@style/MyCustomTheme" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 


<com.roughike.bottombar.BottomBar 
    android:id="@+id/bottomBar" 
    android:layout_width="match_parent" 
    android:layout_height="52dp" 
    android:layout_alignParentBottom="true" 
    app:bb_behavior="shifting|underNavbar" 
    app:bb_tabXmlResource="@xml/bottombar_tabs_main_screen"/> 

THAS的我有什麼:

enter image description here

這是動作條,我想:

enter image description here

+0

您是否在清單中包含了MyCustomTheme風格? –

+0

你的App主題是什麼?你有沒有使用Theme.AppCompat相關的Activity或App主題?你能提供你的清單代碼嗎? –

回答

0

的解決方案是這樣的(因爲我使用程序兼容性):

  1. 我的風格:

    @風格/動作條 @風格/動作條

    @ drawable/bgd @ drawable/bgd @ mipmap/ic_launcher_round @紋理貼圖/ ic_launcher_round useLogo | showHome

2.我不得不從我的清單文件revome任何標識atributes; 3.您可以在這裏看到Logo are not displayed in Actionbar, using AppCompat

0

Im'm試圖確切的活動中使用它,這是我的清單:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="org.workout.mauzerthecat.vesortupdate"> 

<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=".MainActivity" 
       android:theme="@style/MyCustomTheme"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN"/> 

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

同樣重新SULT;