2017-10-17 19 views
1

Je suis en train de mettre drawable comme l'image pour actionbar dans mon activité, en utilisant @style, mais ne voit pas de résultat ... Ceci est mon @styles:Comment configurer l'image actionbar avec @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> 

Ceci est mon code d'activité:

<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"/> 

STAM est ce que j'ai:

enter image description here

C'est que actionbar, je veux obtenir:

enter image description here

+0

Avez-vous inclus le style MyCustomTheme dans votre manifeste? –

+0

Quel est le thème de votre application? Avez-vous utilisé Theme.AppCompat pour un thème d'activité ou d'application associé? Pouvez-vous fournir votre code manifeste? –

Répondre

0

La solution était comme ça (comme j'utilise AppCompat):

  1. Mes styles:

    @ Style/ActionBar @ Style/ActionBar

    @ drawable/bgd @ drawable/bgd @ mipmap/ic_launcher_round @ mipmap/ic_launcher_round useLogo | showhome

2.I devait revome tout logo atributs de mon dossier Manifest; 3. Vous pouvez voir ici Logo are not displayed in Actionbar, using AppCompat

0

Im'm essayant d'utiliser l'activité exacte, ceci est mon manifeste:

<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> 

Idem re sult;