AppCompat Actionbar styling

后端 未结 4 1736
别那么骄傲
别那么骄傲 2021-02-07 20:03

I\'m currently trying to use AppCompat instead of ActionbarSherlock. On Android 4+ devices I don\'t run into any problems, as the normal Actionbar and Holo theme are used.

4条回答
  •  醉梦人生
    2021-02-07 21:06

    To show custom icon & color in AppCompatActivity we can paste this code:

    values/styles.xml

    
    
     
    
    
    

    values-v14/styles.xml

    
    
    
    
    
    

    You can use your custom background picture as well from @drawable/your_pic.png

    To show app icon & Text you also paste this to your activity.

            // set action Bar icon & Text
        ActionBar mActionBar = getSupportActionBar();
        mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE
                | ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);
    

提交回复
热议问题