Java Code Examples for android.view.Window#requestFeature()

The following examples show how to use android.view.Window#requestFeature() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditFragment.java    From EasyPhotos with Apache License 2.0 6 votes vote down vote up
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    Window dialogWindow = getDialog().getWindow();
    if (null != dialogWindow) {
        WindowManager.LayoutParams attrs = dialogWindow.getAttributes();
        attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
        dialogWindow.setAttributes(attrs);
        dialogWindow.requestFeature(Window.FEATURE_NO_TITLE);
    }

    super.onActivityCreated(savedInstanceState);

    if (null != dialogWindow) {
        dialogWindow.setBackgroundDrawable(new ColorDrawable(0x00000000));
        dialogWindow.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
        dialogWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    }
}
 
Example 2
Source File: EditFragment.java    From imsdk-android with MIT License 6 votes vote down vote up
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    Window dialogWindow = getDialog().getWindow();
    if (null != dialogWindow) {
        WindowManager.LayoutParams attrs = dialogWindow.getAttributes();
        attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
        dialogWindow.setAttributes(attrs);
        dialogWindow.requestFeature(Window.FEATURE_NO_TITLE);
    }

    super.onActivityCreated(savedInstanceState);

    if (null != dialogWindow) {
        dialogWindow.setBackgroundDrawable(new ColorDrawable(0x00000000));
        dialogWindow.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
        dialogWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    }
}
 
Example 3
Source File: BasicPopup.java    From AndroidPicker with MIT License 6 votes vote down vote up
private void initDialog() {
    contentLayout = new FrameLayout(activity);
    contentLayout.setLayoutParams(new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
    contentLayout.setFocusable(true);
    contentLayout.setFocusableInTouchMode(true);
    dialog = new Dialog(activity);
    dialog.setCanceledOnTouchOutside(true);//触摸屏幕取消窗体
    dialog.setCancelable(true);//按返回键取消窗体
    dialog.setOnKeyListener(this);
    dialog.setOnDismissListener(this);
    Window window = dialog.getWindow();
    if (window != null) {
        window.setGravity(Gravity.BOTTOM);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        //AndroidRuntimeException: requestFeature() must be called before adding content
        window.requestFeature(Window.FEATURE_NO_TITLE);
        window.setContentView(contentLayout);
    }
    setSize(screenWidthPixels, WRAP_CONTENT);
}
 
Example 4
Source File: BasicPopup.java    From MyBookshelf with GNU General Public License v3.0 6 votes vote down vote up
private void initDialog() {
    contentLayout = new FrameLayout(activity);
    contentLayout.setLayoutParams(new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
    contentLayout.setFocusable(true);
    contentLayout.setFocusableInTouchMode(true);
    dialog = new Dialog(activity);
    dialog.setCanceledOnTouchOutside(true);//触摸屏幕取消窗体
    dialog.setCancelable(true);//按返回键取消窗体
    dialog.setOnKeyListener(this);
    dialog.setOnDismissListener(this);
    Window window = dialog.getWindow();
    if (window != null) {
        window.setGravity(Gravity.BOTTOM);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        //AndroidRuntimeException: requestFeature() must be called before adding content
        window.requestFeature(Window.FEATURE_NO_TITLE);
        window.setContentView(contentLayout);
    }
    setSize(screenWidthPixels, WRAP_CONTENT);
}
 
Example 5
Source File: ScreenUtils.java    From FamilyChat with Apache License 2.0 6 votes vote down vote up
/**
 * 5.0以上切换NavigationBar颜色
 * !!!注意!!!需要在Activity的onCreate()之前调用以下方法
 */
public static void changeNavigationBarColor(Activity activity, int color)
{
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
    {
        Window window = activity.getWindow();
        window.requestFeature(Window.FEATURE_NO_TITLE);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setNavigationBarColor(color);//切换导航栏颜色
    }
}
 
Example 6
Source File: NotePopupFragment.java    From IslamicLibraryAndroid with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.item_highlight, container);
    v.findViewById(R.id.page_part_number).setVisibility(View.GONE);
    v.findViewById(R.id.date_time).setVisibility(View.GONE);

    Dialog dialog = getDialog();
    Window window = dialog.getWindow();
    if (window != null) {
        window.setGravity(Gravity.BOTTOM);
        window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        window.requestFeature(Window.FEATURE_NO_TITLE);
        getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
    return v;
}
 
Example 7
Source File: FileManagerDialog.java    From PHONK with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.folderchooser_dialog, null);

    Window window = getDialog().getWindow();
    window.requestFeature(Window.FEATURE_NO_TITLE);

    // retrieve display dimensions
    Rect displayRectangle = new Rect();
    window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle);

    int w = (int) (displayRectangle.width() * 0.95);
    int h = (int) (displayRectangle.height() * 0.9);
    window.setLayout(w, h);

    WindowManager.LayoutParams params = window.getAttributes();
    window.setAttributes(params);

    return view;
}
 
Example 8
Source File: SettingsDialogFragment.java    From VideoRecorder with Apache License 2.0 5 votes vote down vote up
@Override
    public void onActivityCreated(Bundle savedInstanceState) {
        Window window = getDialog().getWindow();
        if (window == null) return;
        window.requestFeature(Window.FEATURE_NO_TITLE);
        super.onActivityCreated(savedInstanceState);
//        window.setBackgroundDrawable(new ColorDrawable(0x00000000));
        window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);

    }
 
Example 9
Source File: TimePickerDialog.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@NonNull
@Override
public final Dialog onCreateDialog(@Nullable Bundle bundle) {
  Dialog dialog = super.onCreateDialog(bundle);
  Context context = dialog.getContext();
  int surfaceColor =
      MaterialAttributes.resolveOrThrow(
          context, R.attr.colorSurface, TimePickerDialog.class.getCanonicalName());

  MaterialShapeDrawable background =
      new MaterialShapeDrawable(
          context,
          null,
          0,
          R.style.Widget_MaterialComponents_TimePicker);

  background.initializeElevationOverlay(context);
  background.setFillColor(ColorStateList.valueOf(surfaceColor));
  Window window = dialog.getWindow();
  window.setBackgroundDrawable(background);
  window.requestFeature(Window.FEATURE_NO_TITLE);
  // On some Android APIs the dialog won't wrap content by default. Explicitly update here.
  window.setLayout(
      ViewGroup.LayoutParams.WRAP_CONTENT,
      ViewGroup.LayoutParams.WRAP_CONTENT);
  return dialog;
}
 
Example 10
Source File: MapDialogFragment.java    From openshop.io-android with MIT License 5 votes vote down vote up
@Override
@NonNull
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    Window window = dialog.getWindow();
    if (window != null) {
        window.requestFeature(Window.FEATURE_NO_TITLE);
    }
    return dialog;
}
 
Example 11
Source File: BaseDialogFragment.java    From Simpler with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    //设置无标题
    getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
    //设置从底部弹出
    Window window = getDialog().getWindow();
    WindowManager.LayoutParams params = window.getAttributes();
    params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
    window.requestFeature(Window.FEATURE_NO_TITLE);
    window.setAttributes(params);
    return null;
}
 
Example 12
Source File: AbstractFormDialog.java    From tilt-game-android with MIT License 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);

    Window window = dialog.getWindow();
    window.requestFeature(Window.FEATURE_NO_TITLE);
    return dialog;
}
 
Example 13
Source File: ThemeUtils.java    From FreezeYou with Apache License 2.0 5 votes vote down vote up
static void processAddTranslucent(Activity activity) {
    Window window = activity.getWindow();
    if (window != null) {
        window.requestFeature(Window.FEATURE_NO_TITLE);
        window.setBackgroundDrawableResource(R.color.realTranslucent);
        if (Build.VERSION.SDK_INT >= 19) {
            window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
            window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
    }
}
 
Example 14
Source File: AbstractAlertView.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
private void initView() {
    Window window = getWindow();
    if (window == null) {
        return;
    }
    window.requestFeature(Window.FEATURE_NO_TITLE);

    int layoutId = getLayoutResId();
    if(layoutId != 0){
        setContentView(layoutId);
    }else{
        View contentView = onCreateView();
        if(contentView != null){
            setContentView(contentView);
        }else{
            throw new IllegalArgumentException("initialize failed.check if you have call onCreateView or getLayoutResId");
        }
    }

    setCancelable(true);
    setCanceledOnTouchOutside(true);

    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
        window.setType(WindowManager.LayoutParams.TYPE_APPLICATION_PANEL);
    }

    window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
    window.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));

    onInitView(window);
}
 
Example 15
Source File: SampleListActivity.java    From Scrollable with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle sis) {
    super.onCreate(sis);

    final Window window = getWindow();
    window.requestFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.activity_sample_list);

    final ScrollableLayout scrollableLayout = findView(R.id.scrollable_layout);
    final RecyclerView recyclerView = findView(R.id.recycler_view);
    final SampleHeaderView headerView = findView(R.id.header);

    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setHasFixedSize(true);

    scrollableLayout.setCanScrollVerticallyDelegate(new CanScrollVerticallyDelegate() {
        @Override
        public boolean canScrollVertically(int direction) {
            return recyclerView.canScrollVertically(direction);
        }
    });
    scrollableLayout.addOnScrollChangedListener(new SampleHeaderViewOnScrollChangedListener(headerView));

    scrollableLayout.setOnFlingOverListener(new OnFlingOverListener() {
        @Override
        public void onFlingOver(int y, long duration) {
            recyclerView.smoothScrollBy(0, y);
        }
    });
    scrollableLayout.setOverScrollListener(new ZoomInHeaderOverScrollListener(headerView, recyclerView));

    final ViewTypesAdapter<SampleListItem> adapter = ViewTypesAdapter.builder(SampleListItem.class)
            .register(SampleListItem.class, new SampleListItemViewType())
            .setHasStableIds(true)
            .registerOnClickListener(new OnItemClickListener<SampleListItem, Holder>() {
                @Override
                public void onItemClick(SampleListItem item, Holder holder) {
                    // yeah, conditions...
                    if (ScrollableDialog.class.equals(item.sampleActivityClass())) {
                        final ScrollableDialog dialog = new ScrollableDialog();
                        dialog.show(getSupportFragmentManager(), "tag.Dialog");
                    } else {
                        final Intent intent = new Intent(SampleListActivity.this, item.sampleActivityClass());
                        startActivity(intent);
                    }
                }
            })
            .build(this);
    adapter.setItems(sampleItems(getApplicationContext()));
    recyclerView.setAdapter(adapter);
}
 
Example 16
Source File: ActivityUtils.java    From tilt-game-android with MIT License 4 votes vote down vote up
public static final void requestFullscreen(final Activity pActivity) {
	final Window window = pActivity.getWindow();
	window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
	window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
	window.requestFeature(Window.FEATURE_NO_TITLE);
}
 
Example 17
Source File: CropImmersiveManage.java    From PictureSelector with Apache License 2.0 4 votes vote down vote up
/**
 * @param baseActivity
 * @param statusBarColor     状态栏的颜色
 * @param navigationBarColor 导航栏的颜色
 */
public static void immersiveAboveAPI23(AppCompatActivity baseActivity, boolean isMarginStatusBar
        , boolean isMarginNavigationBar, int statusBarColor, int navigationBarColor, boolean isDarkStatusBarIcon) {
    try {
        Window window = baseActivity.getWindow();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            //4.4版本及以上 5.0版本及以下
            window.setFlags(
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            if (isMarginStatusBar && isMarginNavigationBar) {
                //5.0版本及以上
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                        | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
                CropLightStatusBarUtils.setLightStatusBar(baseActivity, isMarginStatusBar
                        , isMarginNavigationBar
                        , statusBarColor == Color.TRANSPARENT
                        , isDarkStatusBarIcon);

                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            } else if (!isMarginStatusBar && !isMarginNavigationBar) {
                window.requestFeature(Window.FEATURE_NO_TITLE);
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                        | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);

                CropLightStatusBarUtils.setLightStatusBar(baseActivity, isMarginStatusBar
                        , isMarginNavigationBar
                        , statusBarColor == Color.TRANSPARENT
                        , isDarkStatusBarIcon);

                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);


            } else if (!isMarginStatusBar && isMarginNavigationBar) {
                window.requestFeature(Window.FEATURE_NO_TITLE);
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                        | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
                CropLightStatusBarUtils.setLightStatusBar(baseActivity, isMarginStatusBar
                        , isMarginNavigationBar
                        , statusBarColor == Color.TRANSPARENT
                        , isDarkStatusBarIcon);

                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);


            } else {
                //留出来状态栏 不留出来导航栏 没找到办法。。
                return;
            }

            window.setStatusBarColor(statusBarColor);
            window.setNavigationBarColor(navigationBarColor);

        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 18
Source File: ImmersiveManage.java    From PictureSelector with Apache License 2.0 4 votes vote down vote up
/**
 * @param baseActivity
 * @param statusBarColor     状态栏的颜色
 * @param navigationBarColor 导航栏的颜色
 */
public static void immersiveAboveAPI23(AppCompatActivity baseActivity, boolean isMarginStatusBar
        , boolean isMarginNavigationBar, int statusBarColor, int navigationBarColor, boolean isDarkStatusBarIcon) {
    try {
        Window window = baseActivity.getWindow();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            //4.4版本及以上 5.0版本及以下
            window.setFlags(
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            if (isMarginStatusBar && isMarginNavigationBar) {
                //5.0版本及以上
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                        | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
                LightStatusBarUtils.setLightStatusBar(baseActivity, isMarginStatusBar
                        , isMarginNavigationBar
                        , statusBarColor == Color.TRANSPARENT
                        , isDarkStatusBarIcon);

                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            } else if (!isMarginStatusBar && !isMarginNavigationBar) {
                window.requestFeature(Window.FEATURE_NO_TITLE);
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                        | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);

                LightStatusBarUtils.setLightStatusBar(baseActivity, isMarginStatusBar
                        , isMarginNavigationBar
                        , statusBarColor == Color.TRANSPARENT
                        , isDarkStatusBarIcon);

                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);


            } else if (!isMarginStatusBar && isMarginNavigationBar) {
                window.requestFeature(Window.FEATURE_NO_TITLE);
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                        | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
                LightStatusBarUtils.setLightStatusBar(baseActivity, isMarginStatusBar
                        , isMarginNavigationBar
                        , statusBarColor == Color.TRANSPARENT
                        , isDarkStatusBarIcon);

                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);


            } else {
                //留出来状态栏 不留出来导航栏 没找到办法。。
                return;
            }

            window.setStatusBarColor(statusBarColor);
            window.setNavigationBarColor(navigationBarColor);

        }
    } catch (Exception e) {
    }
}
 
Example 19
Source File: CropImmersiveManage.java    From Matisse-Kotlin with Apache License 2.0 4 votes vote down vote up
/**
 * @param baseActivity
 * @param statusBarColor     状态栏的颜色
 * @param navigationBarColor 导航栏的颜色
 */
public static void immersiveAboveAPI23(AppCompatActivity baseActivity, boolean isMarginStatusBar
        , boolean isMarginNavigationBar, int statusBarColor, int navigationBarColor, boolean isDarkStatusBarIcon) {
    try {
        Window window = baseActivity.getWindow();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            //4.4版本及以上 5.0版本及以下
            window.setFlags(
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            if (isMarginStatusBar && isMarginNavigationBar) {
                //5.0版本及以上
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                        | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
                CropLightStatusBarUtils.setLightStatusBar(baseActivity, isMarginStatusBar
                        , isMarginNavigationBar
                        , statusBarColor == Color.TRANSPARENT
                        , isDarkStatusBarIcon);

                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            } else if (!isMarginStatusBar && !isMarginNavigationBar) {
                window.requestFeature(Window.FEATURE_NO_TITLE);
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                        | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);

                CropLightStatusBarUtils.setLightStatusBar(baseActivity, isMarginStatusBar
                        , isMarginNavigationBar
                        , statusBarColor == Color.TRANSPARENT
                        , isDarkStatusBarIcon);

                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);


            } else if (!isMarginStatusBar && isMarginNavigationBar) {
                window.requestFeature(Window.FEATURE_NO_TITLE);
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                        | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
                CropLightStatusBarUtils.setLightStatusBar(baseActivity, isMarginStatusBar
                        , isMarginNavigationBar
                        , statusBarColor == Color.TRANSPARENT
                        , isDarkStatusBarIcon);

                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);


            } else {
                //留出来状态栏 不留出来导航栏 没找到办法。。
                return;
            }

            window.setStatusBarColor(statusBarColor);
            window.setNavigationBarColor(navigationBarColor);

        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 20
Source File: ActivityUtils.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public static void requestFullscreen(final Activity pActivity) {
	final Window window = pActivity.getWindow();
	window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
	window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
	window.requestFeature(Window.FEATURE_NO_TITLE);
}