Dark theme android app

后端 未结 5 1532
萌比男神i
萌比男神i 2020-12-16 04:11

I\'m trying to create a dark theme similar to the one in OxygenOS on OnePlus devices.

I changed the window background to black but the problem is the action

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-16 04:48

    Replace these values in your colors.xml

    #101010
    #000000
    

    This would be enough to change the Toolbar's color.


    If you don't want to change the whole app primary color (which seems it is what you were trying to do in the first place), try creating a new Toolbar by:

    Add this to your app's build.gradle

    compile 'com.android.support:design:23.1.1'
    

    Add this to your main layout (activity_main.xml)

    
    
    
        
    
            
    
        
    
    
    

    Set this in your styles (styles.xml):

    
    

    And set the new toolbar (MainActivity.java).

    Toolbar toolbar = (Toolbar) findViewById(R.id.a_main_toolbar);
    setSupportActionBar(toolbar);
    

提交回复
热议问题