当前位置: 首页>>代码示例>>Java>>正文


Java View.setFitsSystemWindows方法代码示例

本文整理汇总了Java中android.view.View.setFitsSystemWindows方法的典型用法代码示例。如果您正苦于以下问题:Java View.setFitsSystemWindows方法的具体用法?Java View.setFitsSystemWindows怎么用?Java View.setFitsSystemWindows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.setFitsSystemWindows方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setRootView

import android.view.View; //导入方法依赖的package包/类
private void setRootView(Activity activity, boolean fit) {
    ViewGroup parent = (ViewGroup) activity.findViewById(android.R.id.content);
    for (int i = 0, count = parent.getChildCount(); i < count; i++) {
        View childView = parent.getChildAt(i);
        if (childView instanceof ViewGroup) {
            childView.setFitsSystemWindows(fit);
            ((ViewGroup)childView).setClipToPadding(fit);
        }
    }
}
 
开发者ID:wavening,项目名称:TransparentBar,代码行数:11,代码来源:UltimateBar.java

示例2: setupUserView

import android.view.View; //导入方法依赖的package包/类
/**
 * 配置Activity。主要配置Activity的用户视图对状态栏和导航栏的留白
 *
 * @param activity Activity对象,不可为空
 * @throws IllegalStateException
 */
private void setupUserView(@NonNull Activity activity) throws IllegalStateException {
    ViewGroup contentViewGroup = (ViewGroup) activity.findViewById(android.R.id.content);
    final int childViewCount = contentViewGroup.getChildCount();
    if (childViewCount == 0) {
        throw new IllegalStateException("Plz invoke setContentView() method first!");
    } else if (childViewCount > 1) {
        throw new IllegalStateException("Plz set one view in SetContentView() or shouldn't use merge tag!!");
    }

    View userView = contentViewGroup.getChildAt(0);
    userView.setFitsSystemWindows(false);
    ViewGroup.MarginLayoutParams userViewParams = (ViewGroup.MarginLayoutParams) userView.getLayoutParams();
    userViewParams.topMargin += ImmerseGlobalConfig.getInstance().getStatusBarHeight();
    if (mActivityConfig.hasNavigtionBar()) {
        if (mActivityConfig.isNavigationAtBottom()) {
            userViewParams.bottomMargin += mActivityConfig.getNavigationBarHeight();
        } else {
            userViewParams.rightMargin += mActivityConfig.getNavigationBarWidth();
        }
    }
    userView.setLayoutParams(userViewParams);
}
 
开发者ID:ls1110924,项目名称:ImmerseMode,代码行数:29,代码来源:TlSbTlNbImmerseMode.java

示例3: addChrono

import android.view.View; //导入方法依赖的package包/类
public void addChrono() {
    mInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View va = mInflater.inflate(R.layout.list_item_timer, null, false);
    va.setFitsSystemWindows(true);
    Button button = (Button) va.findViewById(R.id.chrono);
    button.setOnClickListener(this);

    TimerBackend timerBackend = new TimerBackend(va, setMiliSeconds,this);

    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,50,1);
    mLayout.addView(va, lp);
    mTimers.add(timerBackend);

    //turn the first timer if there is only 2 of them
    if (mTimers.size() == 2){
        mTimers.get(0).getmView().setRotation(180);
    }else{
        mTimers.get(0).getmView().setRotation(0);
    }
}
 
开发者ID:ndleyton,项目名称:OneTwo,代码行数:21,代码来源:TimerFragment.java

示例4: setupContentViewAndStatusBarView

import android.view.View; //导入方法依赖的package包/类
@NonNull
private View setupContentViewAndStatusBarView(@NonNull Activity activity) throws IllegalStateException {
    ViewGroup contentViewGroup = (ViewGroup) activity.findViewById(android.R.id.content);
    View userView = contentViewGroup.getChildAt(0);
    if (userView == null) {
        throw new IllegalStateException("Plz invode setContentView() method first!");
    }

    userView.setFitsSystemWindows(false);

    mInsetsRect.top = ImmerseGlobalConfig.getInstance().getStatusBarHeight();

    View statusBarView = new View(activity);
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mInsetsRect.top);
    contentViewGroup.addView(statusBarView, params);

    return statusBarView;
}
 
开发者ID:ls1110924,项目名称:ImmerseMode,代码行数:19,代码来源:TpSbNNbwFCImmerseMode.java

示例5: setupStatusBarView

import android.view.View; //导入方法依赖的package包/类
@NonNull
private View setupStatusBarView(@NonNull Activity activity) throws IllegalStateException {
    ViewGroup contentViewGroup = (ViewGroup) activity.findViewById(android.R.id.content);
    View userView = contentViewGroup.getChildAt(0);
    if (userView == null) {
        throw new IllegalStateException("Plz invode setContentView() method first!");
    }

    userView.setFitsSystemWindows(false);

    mInsetsRect.top = ImmerseGlobalConfig.getInstance().getStatusBarHeight();

    View statusBarView = new View(activity);
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mInsetsRect.top);
    contentViewGroup.addView(statusBarView, params);

    return statusBarView;
}
 
开发者ID:ls1110924,项目名称:ImmerseMode,代码行数:19,代码来源:TlSbNNbwFCImmerseMode.java

示例6: setStatusBarColor

import android.view.View; //导入方法依赖的package包/类
/**
 * set StatusBarColor
 * <p>
 * 1. set Flags to call setStatusBarColor
 * 2. call setSystemUiVisibility to clear translucentStatusBar's Flag.
 * 3. set FitsSystemWindows to false
 */
static void setStatusBarColor(Activity activity, int statusColor, boolean isLight) {
	Window window = activity.getWindow();

	window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
	window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
	window.setStatusBarColor(statusColor);
	int options = View.SYSTEM_UI_FLAG_VISIBLE;
	if (isLight) {
		options = options | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
	}
	window.getDecorView().setSystemUiVisibility(options);
	ViewGroup contentview = (ViewGroup) window.findViewById(Window.ID_ANDROID_CONTENT);
	View childview = contentview.getChildAt(0);
	if (childview != null) {
		childview.setFitsSystemWindows(false);
		childview.requestApplyInsets();
	}
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:26,代码来源:StatusBarCompatLollipop.java

示例7: setStatusBarColor

import android.view.View; //导入方法依赖的package包/类
/**
 * set StatusBarColor
 * <p>
 * 1. set Window Flag : WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
 * 2. removeFakeStatusBarViewIfExist
 * 3. addFakeStatusBarView
 * 4. addMarginTopToContentChild
 * 5. cancel ContentChild's fitsSystemWindow
 */
static void setStatusBarColor(Activity activity, int statusColor) {
	Window window = activity.getWindow();
	window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

	ViewGroup contentview = (ViewGroup) window.findViewById(Window.ID_ANDROID_CONTENT);
	View contentchild = contentview.getChildAt(0);
	int statusBarHeight = getStatusBarHeight(activity);

	removeFakeStatusBarViewIfExist(activity);
	addFakeStatusBarView(activity, statusColor, statusBarHeight);
	addMarginTopToContentChild(contentchild, statusBarHeight);

	if (contentchild != null) {
		contentchild.setFitsSystemWindows(false);
	}
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:26,代码来源:StatusBarCompatKitKat.java

示例8: setRootView

import android.view.View; //导入方法依赖的package包/类
/**
 * 设置根布局参数
 */
private static void setRootView(Activity activity) {
    ViewGroup parent = (ViewGroup) activity.findViewById(android.R.id.content);
    for (int i = 0, count = parent.getChildCount(); i < count; i++) {
        View childView = parent.getChildAt(i);
        if (childView instanceof ViewGroup) {
            childView.setFitsSystemWindows(true);
            ((ViewGroup) childView).setClipToPadding(true);
        }
    }
}
 
开发者ID:hoangkien0705,项目名称:Android-UtilCode,代码行数:14,代码来源:BarUtils.java

示例9: onCreateView

import android.view.View; //导入方法依赖的package包/类
@SuppressLint("NewApi")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_menu, container, false);
    rootView.setFitsSystemWindows(mMenuParams.isFitsSystemWindow());
    ((ViewGroup) rootView).setClipToPadding(mMenuParams.isClipToPadding());

    initViews(rootView);
    getDialog().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    initDropDownMenuAdapter();
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            mDropDownMenuAdapter.menuToggle();
        }
    }, mMenuParams.getAnimationDelay());

    if (mMenuParams.isClosableOutside()) {
        rootView.findViewById(R.id.root).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (isAdded()) {
                    dismiss();
                }
            }
        });
    }
    return rootView;
}
 
开发者ID:zongkaili,项目名称:MenuSet,代码行数:30,代码来源:ContextMenuDialogFragment.java

示例10: translucentStatusBar

import android.view.View; //导入方法依赖的package包/类
/**
 * translucentStatusBar
 * <p>
 * 1. set Window Flag : WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
 * 2. removeFakeStatusBarViewIfExist
 * 3. removeMarginTopOfContentChild
 * 4. cancel ContentChild's fitsSystemWindow
 */
static void translucentStatusBar(Activity activity) {
	Window window = activity.getWindow();
	window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

	ViewGroup contentview = (ViewGroup) activity.findViewById(Window.ID_ANDROID_CONTENT);
	View contentchild = contentview.getChildAt(0);

	removeFakeStatusBarViewIfExist(activity);
	removeMarginTopOfContentChild(contentchild, getStatusBarHeight(activity));
	if (contentchild != null) {
		contentchild.setFitsSystemWindows(false);
	}
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:22,代码来源:StatusBarCompatKitKat.java

示例11: setFitsSystemWindows

import android.view.View; //导入方法依赖的package包/类
public static void setFitsSystemWindows(View view, boolean fitSystemWindows) {
    view.setFitsSystemWindows(fitSystemWindows);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:4,代码来源:ViewCompatICS.java

示例12: onCreate

import android.view.View; //导入方法依赖的package包/类
public void onCreate() {
	if (pageList == null) {
		pageList = new ArrayList<BasePage>();
	}
	pageList.add(this);

	activity.setTheme(ResHelper.getStyleRes(activity, "BBS_AppTheme"));

	Window window = activity.getWindow();
	if (isFullScreen() && Build.VERSION.SDK_INT >= 11) {
		window.getDecorView().setSystemUiVisibility(0x00000100  //SYSTEM_UI_FLAG_LAYOUT_STABLE
				| 0x00000001                                    //SYSTEM_UI_FLAG_LOW_PROFILE
				| 0x00000200                                    //SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
				| 0x00000400                                    //SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
				| 0x00000004                                    //SYSTEM_UI_FLAG_FULLSCREEN
				| 0x00000002                                    //SYSTEM_UI_FLAG_HIDE_NAVIGATION
				| 0x00001000);                                  //SYSTEM_UI_FLAG_IMMERSIVE_STICKY //在导航栏或状态栏区域上滑或下滑时出现导航栏和状态栏,一段时间后自动隐藏
	} else if (Build.VERSION.SDK_INT >= 21) {
		window.clearFlags(0x04000000                                  // LayoutParams.FLAG_TRANSLUCENT_STATUS
				| 0x08000000);                                        // LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
		window.getDecorView().setSystemUiVisibility(0x00000400        // View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
				| 0x00000200                                          // View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
				| 0x00000100);                                        // View.SYSTEM_UI_FLAG_LAYOUT_STABLE
		window.addFlags(0x80000000);                                  // LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
		if (nInitStatusBarColor != null) {
			setStatusBarColor(nInitStatusBarColor);
		} else {
			int statusBarColor = getStatusBarColor();
			if (statusBarColor != 0) {
				setStatusBarColor(statusBarColor);
			}
		}
	}

	View contentView = onCreateView(activity);
	if (contentView != null) {
		if (isUseDefaultBackground() && Build.VERSION.SDK_INT >= 14) {
			contentView.setFitsSystemWindows(true);
		}
		activity.setContentView(contentView);
		onViewCreated(contentView);
	}
	registerLoginoutBroadCastReciever();
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:45,代码来源:BasePage.java


注:本文中的android.view.View.setFitsSystemWindows方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。