本文整理了Java中android.view.Window.setFlags()
方法的一些代码示例,展示了Window.setFlags()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.setFlags()
方法的具体详情如下:
包路径:android.view.Window
类名称:Window
方法名:setFlags
暂无
代码示例来源:origin: stackoverflow.com
Window window = this.getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
代码示例来源:origin: stackoverflow.com
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = 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);
}
代码示例来源:origin: gzu-liyujiang/AndroidPicker
/**
* 保持屏幕常亮
*/
public static void keepBright(Activity activity) {
//需在setContentView前调用
int keepScreenOn = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
activity.getWindow().setFlags(keepScreenOn, keepScreenOn);
}
代码示例来源:origin: libgdx/libgdx
@Override
public void setUndecorated (boolean undecorated) {
final int mask = (undecorated) ? 1 : 0;
app.getApplicationWindow().setFlags(LayoutParams.FLAG_FULLSCREEN, mask);
}
代码示例来源:origin: libgdx/libgdx
@Override
public void setUndecorated (boolean undecorated) {
final int mask = (undecorated) ? 1 : 0;
app.getApplicationWindow().setFlags(LayoutParams.FLAG_FULLSCREEN, mask);
}
代码示例来源:origin: gzu-liyujiang/AndroidPicker
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;
}
}
代码示例来源:origin: gzu-liyujiang/AndroidPicker
/**
* 设置透明
*/
private static void setTransparentForWindow(Activity activity) {
Window window = activity.getWindow();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.setStatusBarColor(Color.TRANSPARENT);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
代码示例来源:origin: smuyyh/BookReader
@Override
public int getLayoutId() {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
statusBarColor = ContextCompat.getColor(this, R.color.reader_menu_bg_color);
return R.layout.activity_read;
}
代码示例来源:origin: androidquery/androidquery
/**
* Set the activity to be hardware accelerated. Only applies when device API is 11+.
*
* @return self
*/
public T hardwareAccelerated11(){
if(act != null){
act.getWindow().setFlags(AQuery.FLAG_HARDWARE_ACCELERATED, AQuery.FLAG_HARDWARE_ACCELERATED);
}
return self();
}
代码示例来源:origin: AppIntro/AppIntro
/**
* Allows for setting statusbar visibility (true by default)
*
* @param isVisible put true to show status bar, and false to hide it
*/
public void showStatusBar(boolean isVisible) {
if (!isVisible) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_listview_chart);
setTitle("ListViewBarChartActivity");
ListView lv = findViewById(R.id.listView1);
ArrayList<BarData> list = new ArrayList<>();
// 20 items
for (int i = 0; i < 20; i++) {
list.add(generateData(i + 1));
}
ChartDataAdapter cda = new ChartDataAdapter(getApplicationContext(), list);
lv.setAdapter(cda);
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_awesomedesign);
setTitle("SimpleChartDemo");
ViewPager pager = findViewById(R.id.pager);
pager.setOffscreenPageLimit(3);
PageAdapter a = new PageAdapter(getSupportFragmentManager());
pager.setAdapter(a);
AlertDialog.Builder b = new AlertDialog.Builder(this);
b.setTitle("This is a ViewPager.");
b.setMessage("Swipe left and right for more awesome design examples!");
b.setPositiveButton("OK", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
b.show();
}
代码示例来源:origin: lipangit/JiaoZiVideoPlayer
@SuppressLint("RestrictedApi")
public static void hideSupportActionBar(Context context) {
if (ACTION_BAR_EXIST && JZUtils.getAppCompActivity(context) != null) {
ActionBar ab = JZUtils.getAppCompActivity(context).getSupportActionBar();
if (ab != null) {
ab.setShowHideAnimationEnabled(false);
ab.hide();
}
}
if (TOOL_BAR_EXIST) {
JZUtils.getWindow(context).setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_listview_chart);
setTitle("ListViewMultiChartActivity");
ListView lv = findViewById(R.id.listView1);
ArrayList<ChartItem> list = new ArrayList<>();
// 30 items
for (int i = 0; i < 30; i++) {
if(i % 3 == 0) {
list.add(new LineChartItem(generateDataLine(i + 1), getApplicationContext()));
} else if(i % 3 == 1) {
list.add(new BarChartItem(generateDataBar(i + 1), getApplicationContext()));
} else if(i % 3 == 2) {
list.add(new PieChartItem(generateDataPie(), getApplicationContext()));
}
}
ChartDataAdapter cda = new ChartDataAdapter(getApplicationContext(), list);
lv.setAdapter(cda);
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_colored_lines);
setTitle("LineChartActivityColored");
charts[0] = findViewById(R.id.chart1);
charts[1] = findViewById(R.id.chart2);
charts[2] = findViewById(R.id.chart3);
charts[3] = findViewById(R.id.chart4);
Typeface mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Bold.ttf");
for (int i = 0; i < charts.length; i++) {
LineData data = getData(36, 100);
data.setValueTypeface(mTf);
// add some transparency to the color with "& 0x90FFFFFF"
setupChart(charts[i], data, colors[i % colors.length]);
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void getFlag_shouldReturnWindowFlags() throws Exception {
Activity activity = Robolectric.buildActivity(Activity.class).create().get();
Window window = activity.getWindow();
assertThat(shadowOf(window).getFlag(WindowManager.LayoutParams.FLAG_FULLSCREEN)).isFalse();
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
assertThat(shadowOf(window).getFlag(WindowManager.LayoutParams.FLAG_FULLSCREEN)).isTrue();
window.setFlags(WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON);
assertThat(shadowOf(window).getFlag(WindowManager.LayoutParams.FLAG_FULLSCREEN)).isTrue();
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_linechart_noseekbar);
setTitle("DynamicalAddingActivity");
chart = findViewById(R.id.chart1);
chart.setOnChartValueSelectedListener(this);
chart.setDrawGridBackground(false);
chart.getDescription().setEnabled(false);
chart.setNoDataText("No chart data available. Use the menu to add entries and data sets!");
// chart.getXAxis().setDrawLabels(false);
// chart.getXAxis().setDrawGridLines(false);
chart.invalidate();
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_performance_linechart);
setTitle("PerformanceLineChart");
tvCount = findViewById(R.id.tvValueCount);
seekBarValues = findViewById(R.id.seekbarValues);
seekBarValues.setOnSeekBarChangeListener(this);
chart = findViewById(R.id.chart1);
chart.setDrawGridBackground(false);
// no description text
chart.getDescription().setEnabled(false);
// enable touch gestures
chart.setTouchEnabled(true);
// enable scaling and dragging
chart.setDragEnabled(true);
chart.setScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
chart.setPinchZoom(false);
chart.getAxisLeft().setDrawGridLines(false);
chart.getAxisRight().setEnabled(false);
chart.getXAxis().setDrawGridLines(true);
chart.getXAxis().setDrawAxisLine(false);
seekBarValues.setProgress(9000);
// don't forget to refresh the drawing
chart.invalidate();
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_draw_chart);
setTitle("DrawChartActivity");
chart = findViewById(R.id.chart1);
// listener for selecting and drawing
chart.setOnChartValueSelectedListener(this);
chart.setOnDrawListener(this);
// if disabled, drawn data sets with the finger will not be automatically
// finished
// chart.setAutoFinish(true);
chart.setDrawGridBackground(false);
// add dummy-data to the chart
initWithDummyData();
XAxis xl = chart.getXAxis();
xl.setTypeface(tfRegular);
xl.setAvoidFirstLastClipping(true);
YAxis yl = chart.getAxisLeft();
yl.setTypeface(tfRegular);
chart.getLegend().setEnabled(false);
// chart.setYRange(-40f, 40f, true);
// call this to reset the changed y-range
// chart.resetYRange(true);
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_scrollview);
setTitle("ScrollViewActivity");
chart = findViewById(R.id.chart1);
chart.getDescription().setEnabled(false);
// scaling can now only be done on x- and y-axis separately
chart.setPinchZoom(false);
chart.setDrawBarShadow(false);
chart.setDrawGridBackground(false);
XAxis xAxis = chart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setDrawGridLines(false);
chart.getAxisLeft().setDrawGridLines(false);
chart.getLegend().setEnabled(false);
setData(10);
chart.setFitBars(true);
}
内容来源于网络,如有侵权,请联系作者删除!