Android: theme@styleTheme.AppCompat needs to be set in AndroidManifest. xml if the prompt is not found, follow the settings: as to how to introduce the method, please refer to the previous article. I. PublicclassMainActivityextendsActionBarActivity {private
Android: theme = @ style/Theme. AppCompat needs to be set in AndroidManifest. xml. If you cannot find android: theme = @ style/Theme. AppCompat, follow the settings below: For how to introduce the method, see the previous article. I. Use the image as the background and directly reference the image in the Code. public class MainActivity extends ActionBarActivity {private
You need to set in AndroidManifest. xml
Android: theme = "@ style/Theme. AppCompat"
If you cannot find the prompt, follow the settings below:
For how to introduce the method, see the previous article.
I. Use an image as the background
Reference the image directly in the code.
Public class MainActivity extends ActionBarActivity {private ActionBar actionBar; @ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. activity_main); actionBar = getSupportActionBar (); // you can specify the title actionBar. setTitle ("Bar example"); actionBar. setSubtitle ("effort! "); // The user clicks the ActionBar icon and returns the previous activity actionBar. setDisplayHomeAsUpEnabled (true );// Background image Resources res = getResources (); Drawable myDrawable = res. getDrawable (R. drawable. top_theme_blue); actionBar. setBackgroundDrawable (myDrawable );}
II. Use gradient color as the background
2.1 generate the actionbar_gradient_bg.xml File
2.2 specify in the code
// Set the gradient background actionBar. setBackgroundDrawable (getResources (). getDrawable (R. drawable. actionbar_gradient_bg ));