Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. <menu xmlns:android="http://schemas.android.com/apk/res/android"
  2. xmlns:app="http://schemas.android.com/apk/res-auto"
  3. xmlns:tools="http://schemas.android.com/tools"
  4. tools:context="erfanrouhani.flashalerts.MainActivity">
  5.  
  6.  
  7. <item
  8. android:id="@+id/myswitch"
  9. android:title=""
  10. app:showAsAction="always"
  11. app:actionViewClass="android.widget.Switch"/>
  12. </menu>
  13.  
  14. @Override
  15. public boolean onCreateOptionsMenu(Menu menu) {
  16. getMenuInflater().inflate(R.menu.menu_main, menu);
  17.  
  18.  
  19. Switch switchactive = (Switch) menu.findItem(R.id.myswitch).getActionView();
  20. switchactive.setChecked(shared.getBoolean("switchactive",true));
  21. switchactive.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  22. @Override
  23. public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
  24.  
  25.  
  26. }
  27. });
  28.  
  29.  
  30. return true;
  31. }
  32.  
  33. <resources>
  34.  
  35. <!-- Base application theme. -->
  36. <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
  37. <!-- Customize your theme here. -->
  38. <item name="colorPrimary">@color/colorPrimary</item>
  39. <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
  40. <item name="colorAccent">@color/colorAccent</item>
  41. </style>
  42.  
  43. <style name="AppTheme.NoActionBar">
  44. <item name="windowActionBar">false</item>
  45. <item name="windowNoTitle">true</item>
  46. </style>
  47.  
  48. <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
  49.  
  50. <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement