Guest User

Untitled

a guest
Nov 2nd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 KB | None | 0 0
  1. setContentView(R.layout.main);
  2.  
  3. // experiment with the ActionBar
  4. ActionBar actionBar = getActionBar();
  5. actionBar.hide();
  6.  
  7. @Override
  8. protected void onCreate(Bundle savedInstanceState) {
  9. super.onCreate(savedInstanceState);
  10.  
  11. // The Action Bar is a window feature. The feature must be requested
  12. // before setting a content view. Normally this is set automatically
  13. // by your Activity's theme in your manifest. The provided system
  14. // theme Theme.WithActionBar enables this for you. Use it as you would
  15. // use Theme.NoTitleBar. You can add an Action Bar to your own themes
  16. // by adding the element <item name="android:windowActionBar">true</item>
  17. // to your style definition.
  18. getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
  19.  
  20. setContentView(R.layout.main);
  21.  
  22. // experiment with the ActionBar
  23. ActionBar actionBar = getActionBar();
  24. actionBar.hide();
  25. }
  26.  
  27. public class MagicActivity extends Activity
  28.  
  29. <application
  30. ...
  31. android:theme="@android:style/Theme.Holo" >
  32.  
  33. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  34. ....
  35. android:theme="@android:style/Theme.WithActionBar" >
  36.  
  37. <application
  38. android:name="com.xxx.yyy.Application"
  39. android:debuggable="false"
  40. android:icon="@drawable/icon"
  41. android:label="@string/app_name"
  42. android:theme="@style/Theme.NoTitle"> // remove this line if you have this in your code
  43.  
  44.  
  45. <activity
  46. android:name="com.xxx.yyy.Activity"
  47. android:configChanges="orientation|keyboardHidden|screenSize"
  48. android:theme="@style/Theme.NoTitle" // remove this line if you have this in your code
  49. android:windowSoftInputMode="adjustResize|stateHidden" >
  50.  
  51. ActionBarActivity actionBarActivity = (ActionBarActivity)getActivity();
  52. ActionBar actionBar = actionBarActivity.getSupportActionBar();
  53.  
  54. android.support.v7.app.ActionBar ab = getSupportActionBar();
  55.  
  56. <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
  57. <!-- API 14 theme customizations can go here. -->
  58. </style>
  59.  
  60. <application
  61. android:name="com.xxx.yyy.Application"
  62. android:debuggable="false"
  63. android:icon="@drawable/icon"
  64. android:label="@string/app_name"
  65. android:theme="@style/Theme.NoTitle"> // remove this line if you have this in your code
  66.  
  67.  
  68. <activity
  69. android:name="com.xxx.yyy.Activity"
  70. android:configChanges="orientation|keyboardHidden|screenSize"
  71. android:theme="@style/Theme.NoTitle" // remove this line if you have this in your code
  72. android:windowSoftInputMode="adjustResize|stateHidden" >
  73.  
  74. @Override
  75. protected void onCreate(Bundle savedInstanceState) {
  76. super.onCreate(savedInstanceState);
  77.  
  78. // The Action Bar is a window feature. The feature must be requested
  79. // before setting a content view. Normally this is set automatically
  80. // by your Activity's theme in your manifest. The provided system
  81. // theme Theme.WithActionBar enables this for you. Use it as you would
  82. // use Theme.NoTitleBar. You can add an Action Bar to your own themes
  83. // by adding the element <item name="android:windowActionBar">true</item>
  84. // to your style definition.
  85. getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
  86. setContentView(R.layout.activity_main);
  87. // Hide the status bar for Android 4.1 and higher
  88. View decorView = getWindow().getDecorView();
  89. // Hide the status bar.
  90. int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
  91. decorView.setSystemUiVisibility(uiOptions);
  92. // Remember that you should never show the action bar if the
  93. // status bar is hidden, so hide that too if necessary.
  94. ActionBar actionBar = getActionBar();
  95. actionBar.hide();
  96. }
  97.  
  98. @Override
  99. protected void onCreate(Bundle savedInstanceState) {
  100.  
  101. getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
  102.  
  103. super.onCreate(savedInstanceState);
  104. setContentView(R.layout.main);
  105.  
  106. // experiment with the ActionBar
  107. ActionBar actionBar = getActionBar();
  108. actionBar.hide();
  109. }
  110.  
  111. protected void onCreate(Bundle savedInstanceState) {
  112. super.onCreate(savedInstanceState);
  113.  
  114. setContentView(R.layout.activity_detail);
  115. getSupportActionBar().setDisplayHomeAsUpEnabled(false);
  116.  
  117.  
  118.  
  119.  
  120. }
Add Comment
Please, Sign In to add comment