Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- tools:context="erfanrouhani.flashalerts.MainActivity">
- <item
- android:id="@+id/myswitch"
- android:title=""
- app:showAsAction="always"
- app:actionViewClass="android.widget.Switch"/>
- </menu>
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.menu_main, menu);
- Switch switchactive = (Switch) menu.findItem(R.id.myswitch).getActionView();
- switchactive.setChecked(shared.getBoolean("switchactive",true));
- switchactive.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
- }
- });
- return true;
- }
- <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>
- <style name="AppTheme.NoActionBar">
- <item name="windowActionBar">false</item>
- <item name="windowNoTitle">true</item>
- </style>
- <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
- <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement