Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The Following code shows how to change color and text, subtext color of ActionBar. Put this file in values/ folder and name it as theme.xml</p> <p> </p> <pre><code>&lt;!-- the theme applied to the application or activity --&gt; &lt;style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"&gt; &lt;item name="android:actionBarStyle"&gt;@style/MyActionBar&lt;/item&gt; &lt;!-- Support library compatibility --&gt; &lt;item name="actionBarStyle"&gt;@style/MyActionBar&lt;/item&gt; &lt;/style&gt; &lt;!-- ActionBar styles --&gt; &lt;style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse"&gt; &lt;item name="android:background"&gt;@color/actionBarBG&lt;/item&gt; &lt;item name="android:backgroundSplit"&gt;@color/actionBarBG&lt;/item&gt; &lt;item name="android:subtitleTextStyle"&gt;@style/Theme.TitleTextStyle&lt;/item&gt; &lt;!-- Support library compatibility --&gt; &lt;item name="background"&gt;@color/actionBarBG&lt;/item&gt; &lt;/style&gt; &lt;!-- STYLE TO CHAGE THE TITLE COLOR OF ACTION BAR --&gt; &lt;style name="Theme.TitleTextStyle" parent="@android:style/Widget.TextView"&gt; &lt;item name="android:textColor"&gt;#BDD6E0&lt;/item&gt; &lt;/style&gt; </code></pre> <p></p> <p>In you manifest apply to the activity as below in activity tag :</p> <pre><code>android:theme="@style/CustomActionBarTheme" </code></pre> <p>For ActionItems in ActionBar you can use following code : eg. action_items.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:yourapp="http://schemas.android.com/apk/res-auto" &gt; &lt;item android:id="@+id/action_home" android:icon="@drawable/action_home" android:showAsAction="ifRoom" android:title="@string/home" yourapp:showAsAction="ifRoom"/&gt; &lt;item android:id="@+id/action_logout" android:icon="@drawable/action_logout" android:showAsAction="ifRoom" yourapp:showAsAction="ifRoom" android:title="@string/logout"/&gt; &lt;/menu&gt; </code></pre> <p>Put this XML file in /Menu folder.</p> <p>Then in activity:</p> <pre><code>@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.action_items, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { // Take appropriate action for each action item click switch (item.getItemId()) { case R.id.action_home: Intent intent = new Intent(this, CustomerMenuActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); return true; case R.id.action_logout: // location found Intent intent2 = new Intent(this, LoginActivity.class); intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent2); return true; default: return super.onOptionsItemSelected(item); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload