本文整理汇总了Java中android.view.Window.setFlags方法的典型用法代码示例。如果您正苦于以下问题:Java Window.setFlags方法的具体用法?Java Window.setFlags怎么用?Java Window.setFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.Window
的用法示例。
在下文中一共展示了Window.setFlags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepare
import android.view.Window; //导入方法依赖的package包/类
private void prepare()
{
global = (Global) getApplication();
lockbtn = (ImageView) findViewById(R.id.lockButton);
lockbtn.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
finish();
}
});
if (ENABLE_NO_STATUSBAR && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
}
示例2: setTranslucentStatusBar
import android.view.Window; //导入方法依赖的package包/类
static void setTranslucentStatusBar(Map message) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ) {
return;
}
final Boolean value = (Boolean) message.get("value");
final Activity activity = QtNative.activity();
Runnable runnable = new Runnable () {
public void run() {
Window w = activity.getWindow(); // in Activity's onCreate() for instance
if (value) {
// w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
} else {
// w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
};
activity.runOnUiThread(runnable);
}
示例3: onCreate
import android.view.Window; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_waiting_future);
View decorView = getWindow().getDecorView();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
decorView.setSystemUiVisibility(option);
getWindow().setStatusBarColor(Color.TRANSPARENT);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window window = getWindow();
// Translucent status bar
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager
.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setTitle(R.string.waitforTitle);
//using butter knife
ButterKnife.bind(this);
}
示例4: onCreate
import android.view.Window; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Window window = getWindow();//第一行
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,//第二行
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);//第三行
setContentView(R.layout.activity_log);
findWeibos();
adapter = new MyAdapter(this);
// 初始化控件
init();
amc();
//设置监听
buttonCreate.setOnClickListener(this);
}
示例5: setFullscreen
import android.view.Window; //导入方法依赖的package包/类
/**
* This method sets whether or not the activity will display
* in full-screen mode (i.e. the ActionBar will be hidden) and
* whether or not immersive mode should be set. This is used to
* set both parameters correctly as during a full-screen video,
* both need to be set, but other-wise we leave it up to user
* preference.
*
* @param enabled true to enable full-screen, false otherwise
* @param immersive true to enable immersive mode, false otherwise
*/
private void setFullscreen(boolean enabled, boolean immersive) {
mIsFullScreen = enabled;
mIsImmersive = immersive;
Window window = getWindow();
View decor = window.getDecorView();
if (enabled) {
if (immersive) {
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
} else {
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
}
示例6: onCreateDialog
import android.view.Window; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
// Idea from here
// http://thanhcs.blogspot.ru/2014/10/android-custom-dialog-fragment.html
Dialog dialog = new Dialog(mContext);
Window window = dialog.getWindow();
window.requestFeature(Window.FEATURE_NO_TITLE);
window.setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
return dialog;
}
示例7: temporarilyDisableDialogFocus
import android.view.Window; //导入方法依赖的package包/类
/**
* Apply a hack to temporarily set the window to not focusable, so that the navigation bar
* will not show up during the transition.
*/
private static void temporarilyDisableDialogFocus(final Window window) {
window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
// Add the SOFT_INPUT_IS_FORWARD_NAVIGATION_FLAG. This is normally done by the system when
// FLAG_NOT_FOCUSABLE is not set. Setting this flag allows IME to be shown automatically
// if the dialog has editable text fields.
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION);
new Handler().post(new Runnable() {
@Override
public void run() {
window.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
}
});
}
示例8: setStatusBar
import android.view.Window; //导入方法依赖的package包/类
public static void setStatusBar(Activity mActivity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window window = mActivity.getWindow();
// 半透明状态栏
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
示例9: onCreate
import android.view.Window; //导入方法依赖的package包/类
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Window window = getWindow();//第一行
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,//第二行
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);//第三行
setContentView(R.layout.activity_create);
init();
//设置监听
buttonCreate.setOnClickListener(this);
}
示例10: isTranslucentActionbar
import android.view.Window; //导入方法依赖的package包/类
public static void isTranslucentActionbar(String LOG_TAG, Context context, Toolbar toolbar, Activity activity) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
Log.d(LOG_TAG, "Settings translucent status bar");
double statusBarHeight = Math.ceil(25 * context.getResources().getDisplayMetrics().density);
Window w = activity.getWindow(); // in Activity's onCreate() for instance
//w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
toolbar.getLayoutParams().height = (int) (context.getResources().getDimension((R.dimen.main_toolbar_height)) + statusBarHeight);
}
}
示例11: setStatusBackground
import android.view.Window; //导入方法依赖的package包/类
private void setStatusBackground()
{
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP)
{
Window window = getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
示例12: toggleFullScreen
import android.view.Window; //导入方法依赖的package包/类
public static void toggleFullScreen(Activity activity) {
Window window = activity.getWindow();
int flagFullscreen = WindowManager.LayoutParams.FLAG_FULLSCREEN;
if (isFullScreen) {
window.clearFlags(flagFullscreen);
isFullScreen = false;
} else {
window.setFlags(flagFullscreen, flagFullscreen);
isFullScreen = true;
}
}
示例13: full
import android.view.Window; //导入方法依赖的package包/类
/**
* 修改状态栏为全透明
*
* @param window
*/
public static void full(Window window) {
if (SysUtils.hasKitKat()) {
if (MIUISetStatusBarLightMode(window, true)) {
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
} else if (FlymeSetStatusBarLightMode(window, true)) {
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
} else if (SysUtils.hasLollipop()) {
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_STABLE);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
}
}
}
示例14: toggleFullScreen
import android.view.Window; //导入方法依赖的package包/类
/**
* Toggle full displayMetrics.
*
* @param activity the activity
*/
public static void toggleFullScreen(Activity activity) {
Window window = activity.getWindow();
int flagFullscreen = WindowManager.LayoutParams.FLAG_FULLSCREEN;
if (isFullScreen) {
window.clearFlags(flagFullscreen);
isFullScreen = false;
} else {
window.setFlags(flagFullscreen, flagFullscreen);
isFullScreen = true;
}
}
示例15: onCreate
import android.view.Window; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Window window = getWindow();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
}
requestWindowFeature(Window.FEATURE_NO_TITLE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
mWebView = new WebView(this);
mWebView.setScrollContainer(false);
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
setContentView(mWebView, layoutParams);
Bundle args = getIntent().getExtras();
String url = args.getString(ARG_URL);
mWebView.setWebViewClient(new WebViewClient());
mWebView.getSettings().setJavaScriptEnabled(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
mWebView.getSettings().setMediaPlaybackRequiresUserGesture(false);
}
mWebView.setWebChromeClient(new WebChromeClient());
mWebView.loadUrl(url);
}