List of usage examples for android.view Window FEATURE_ACTION_BAR
int FEATURE_ACTION_BAR
To view the source code for android.view Window FEATURE_ACTION_BAR.
Click Source Link
From source file:Main.java
public static void showAsPopup(Activity activity) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { return;/* w w w . ja v a 2 s . co m*/ } activity.requestWindowFeature(Window.FEATURE_ACTION_BAR); //To show activity as dialog and dim the background, you need to declare android:theme="@style/PopupTheme" on for the chosen activity on the manifest Window window = activity.getWindow(); window.setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND, WindowManager.LayoutParams.FLAG_DIM_BEHIND); Display display = activity.getWindowManager().getDefaultDisplay(); WindowManager.LayoutParams params = window.getAttributes(); params.height = (int) (display.getHeight() * 0.95); params.width = Math.min((int) (display.getWidth() * 0.9), (int) (params.height * 0.85)); params.gravity = Gravity.BOTTOM; params.alpha = 1.0f; params.dimAmount = 0.5f; window.setAttributes(params); }
From source file:Main.java
/** * Hides the activity's action bar//from w ww . j av a 2s. c o m * * @param activity * the activity */ public static void hideActionBar(Activity activity) { // Call before calling setContentView(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && activity != null) { activity.getWindow().requestFeature(Window.FEATURE_ACTION_BAR); activity.getActionBar().hide(); } }
From source file:Main.java
/** * Removes the action bar from the activity. This only works on API 11+. * * @param activity/* ww w .j ava2s .c o m*/ */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void removeActionBar(Activity activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { activity.getWindow().requestFeature(Window.FEATURE_ACTION_BAR); activity.getActionBar().hide(); } }
From source file:Main.java
/** * Request the ActionBar window feature if we are on a supported Android * version. This should be called before the activity's setContentView. * * @param activity//w w w .j av a 2 s . c o m */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void addActionBarIfSupported(Activity activity) { if (actionBarSupported()) { activity.requestWindowFeature(Window.FEATURE_ACTION_BAR); } }
From source file:org.deviceconnect.android.deviceplugin.host.activity.GeolocationAlertDialogActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mActivity = this; Intent intent = getIntent();//from w w w . j a v a 2 s .c om Bundle bundle = intent.getBundleExtra("Intent"); if (bundle != null) { mResponse = bundle.getParcelable("response"); } getWindow().requestFeature(Window.FEATURE_ACTION_BAR); if (getActionBar() != null) { getActionBar().hide(); } setContentView(R.layout.geolocation_alert_dialog); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setTitle(R.string.gps_settings_title); alertDialogBuilder.setMessage(R.string.host_setting_dialog_disable_gps).setCancelable(false) // GPS?? .setPositiveButton(R.string.gps_settings_title, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent callGPSSettingIntent = new Intent( android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); try { startActivity(callGPSSettingIntent); } catch (ActivityNotFoundException e) { if (mResponse != null) { MessageUtils.setIllegalDeviceStateError(mResponse, "GPS setting is not enabled."); getBaseContext().sendBroadcast(mResponse); } } mActivity.finish(); } }); // ? alertDialogBuilder.setNegativeButton(R.string.host_setting_gps_dialog_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (mResponse != null) { MessageUtils.setIllegalDeviceStateError(mResponse, "GPS setting is not enabled."); getBaseContext().sendBroadcast(mResponse); } dialog.cancel(); mActivity.finish(); } }); AlertDialog alert = alertDialogBuilder.create(); // ?????? alert.show(); }
From source file:dentex.youtube.downloader.docs.ChangelogActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); // Theme init Utils.themeInit(this); setContentView(R.layout.activity_changelog); setupActionBar();/*from w w w. ja v a 2s. c o m*/ }
From source file:dentex.youtube.downloader.docs.CreditsShowActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); // Theme init Utils.themeInit(this); setContentView(R.layout.activity_credits_show); setupActionBar();/*from w w w . j a v a 2 s .co m*/ }
From source file:dentex.youtube.downloader.docs.MitShowActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); // Theme init Utils.themeInit(this); setContentView(R.layout.activity_mit_show); setupActionBar();/*from w w w. java2s. co m*/ }
From source file:dentex.youtube.downloader.docs.LgplShowActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); // Theme init Utils.themeInit(this); setContentView(R.layout.activity_lgpl_show); setupActionBar();/*from w w w . j a va 2 s .c om*/ }
From source file:dentex.youtube.downloader.docs.GplShowActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); // Theme init Utils.themeInit(this); setContentView(R.layout.activity_gpl_show); setupActionBar();//from w w w . j a v a2s . c o m }