Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

[study notes] change the ActionBar related display

Shulou Source: shulou.com Published: 2022-06-03 04:59:59 11月25日 Update

Change the background color of ActionBar

1) Open the res- > styles.xml file, modify its contents, add a style named myAppTheme, integrate the theme into Theme.Holo or its subclasses, and reference an actionbar

2) create a new style of the myActionBar referenced above, and configure the background color of the actionbar

3) in ManifestActivity, the theme in application should be the custom theme

Change the text of ActionBar and center it.

1) create a new xml file for layout, add a textview, and configure text, color and size

2) in the onCreate function of MainActivity, get the actionBar of the current activity through the code, bind the actionBar to the layout we just created, and configure the display to be custom

Third, add the return key in the upper left corner

The return key in the upper left corner of actionbar is hidden by default, so set it to open in the onCreate function and override the onOptionsItemSelected function.

Redefine a view resource that returns an arrow in the res- > styles.xml file

Tags: Functions files colors configurations themes upper-left corner text background lieutenant general code content size layout arrows resources central settings and will notes learning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Shulou Information macOS Microsoft MariaDB