Android Question Using AppCompat Toolbar in 2 or more activities (bug?)

Haris Hafeez

Active Member
Licensed User
Longtime User
Hey guys,

So I got the AppCompat example working (the one that uses MSMaterialDrawer - awesome work that) but now I'm seeing strange behaviour when using two activities instead of one. When you run this app, you will notice that the first activity shows the secondary colour(of the top bar) properly but it changes to blue when i move to the second activity.

In the AppCompat example, I added another activity that is exactly the same as the first one. The only change I made was not to build and show the drawer as in the first activity. I have added the #Extends: android.support.v7.app.ActionBarActivity directive to the second activity so that its set up properly.

Can someone please have a look and see what I need to change?

First Activity:
upload_2015-7-30_12-52-0.png


Second Activity:

upload_2015-7-30_12-52-39.png
 

Attachments

  • AppCompatToolbar.zip
    17.3 KB · Views: 215

Haris Hafeez

Active Member
Licensed User
Longtime User
Ahh I exported the project but it seems it didn't copy the resources folder. I have resolved this BUT I have to say I don't completely understand the mechanics of using AppCompat toolbar with the MSMaterialDrawer.

I think the issue is that the MSMaterialDrawer style values override the theme at some point when the app moves to the next activity. The strange thing it only affects the second activity an not the first even if the second one is almost exactly a clone of the first one.

I resolved this by overriding the styles values used by MSMaterialDrawer by providing my own styles.xml and overriding the primary and seconday colors.

Is there a better way to use MSMaterialDrawer with the AppCompat toolbar with more than one activity?
 

Attachments

  • values.zip
    971 bytes · Views: 167
Upvote 0

deyvitm

Member
Licensed User
Longtime User
urgent,
please can you tell me where under the MSMaterialDrawer file ?, I have seen that this source Java, but not Java and have no way to obtain and it is urgent
 
Upvote 0
Top