Skip to content

Instantly share code, notes, and snippets.

@yahyaahrika
Last active June 26, 2016 23:11
Show Gist options
  • Save yahyaahrika/6c30b38d4c614688dfe972ba6a4f37ad to your computer and use it in GitHub Desktop.
Save yahyaahrika/6c30b38d4c614688dfe972ba6a4f37ad to your computer and use it in GitHub Desktop.
attributes toolbar
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
ActionBar actionBar1 = getSupportActionBar();
getSupportActionBar().setTitle("ello whj"); //change title
// show logo in toolbar
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setLogo(R.drawable.ic_delete);
getSupportActionBar().setDisplayUseLogoEnabled(true);
---------------------- menu_main.xml showAsAction:always show logo and title /// app:showAsAction="never" is hide to points
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/miProfile"
android:icon="@drawable/ic_message_plus"
app:showAsAction="always"
android:title="Profile">
</item>
<item
android:id="@+id/test0"
app:showAsAction="always"
android:title="fin"/>
<item
android:id="@+id/test"
app:showAsAction="never"
android:title="never"/>
<item
android:id="@+id/test2"
app:showAsAction="collapseActionView"
android:title="collapseActionView"/>
<item
android:id="@+id/test3"
app:showAsAction="withText"
android:title="withText"/>
</menu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment