If you want to change the ActionBar, create a custom one from your preferences.
First, create an XML layout of what your custom ActionBar looks like. Here, make sure that you add the ID to the container layout (Linear Layout). This will be necessary in the subsequent steps.
Second Click the XML layout created in your onCreate java code as follows:
LinearLayout myTitleBar = (LinearLayout) findViewById(R.id.the_id_you_set_in_first_step); getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); getSupportActionBar().setCustomView(R.layout.name_of_custom_xml_layout);
Note. . Since you are dealing with an ActionBar, your application theme must be installed on Theme.AppCompat.Light
To learn more about them, check out these quick video tutorials that demonstrate the same thing.
Part one - 5 minutes
The second part - 9min
The third part
Hope this helps!
source share