This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.v7.widget.Toolbar | |
android:id="@+id/toolbar" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="?attr/colorPrimary" | |
android:minHeight="?attr/actionBarSize" | |
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" | |
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> | |
<item name="colorPrimary">@color/primary</item> | |
<item name="colorPrimaryDark">@color/primary_dark</item> | |
<item name="colorAccent">@color/accent</item> | |
</style> | |
<style name="AppTheme.NoTitleBar"> | |
<item name="windowActionBar">false</item> | |
<item name="android:windowNoTitle">true</item> | |
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PreferencesActivity extends BaseActionBarActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_preferences); | |
if (savedInstanceState == null) { | |
getFragmentManager().beginTransaction() | |
.add(R.id.container, new PreferencesFragment()) | |
.commit(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<menu xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto"> | |
<item android:id="@+id/menu_compose" | |
android:icon="@drawable/header_icon_compose_normal" | |
app:showAsAction="ifRoom" | |
android:title="@string/menu_action_compose" /> | |
</menu> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (getActivity() instanceof ActionBarActivity) { | |
ActionBar actionBar = ((ActionBarActivity) getActivity()).getSupportActionBar(); | |
if (actionBar != null) { | |
// Do something with the ActionBar | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseActionBarActivity extends ActionBarActivity { | |
// Implementation | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> | |
<item name="colorPrimary">@color/primary</item> | |
<item name="colorPrimaryDark">@color/primary_dark</item> | |
<item name="colorAccent">@color/accent</item> | |
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
compile 'com.android.support:appcompat-v7:21.0.+' | |
} |
NewerOlder