/** * 是否隐藏title,是否全屏等 * * @param act 需要隐藏界面 * @param strategy 策略类型 1-隐藏title,2-全屏,3-隐藏title并全屏 * @return void */ public static void strategyUi(Activity act, int strategy) { if (strategy == 1) { act.requestWindowFeature(Window.FEATURE_NO_TITLE); } else if (strategy == 2) { act.getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } else if (strategy == 3) { act.requestWindowFeature(Window.FEATURE_NO_TITLE); act.getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } }
/** * 设置全屏 * * @param activity 要设置全屏的activity */ public static void setFullScreen(Activity activity) { activity.requestWindowFeature(Window.FEATURE_NO_TITLE); Window window = activity.getWindow(); WindowManager.LayoutParams params = window.getAttributes(); params.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; window.setAttributes(params); window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); }
public void setFullScreenIfNecessary(Activity a) { if (fullScreen) { a.requestWindowFeature(Window.FEATURE_NO_TITLE); a.getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } }
public void setActivity(Activity activity) { super.setActivity(activity); int resId = getBitmapRes(activity, "ssdk_oks_shake_to_share_back"); if (resId > 0) { activity.setTheme(android.R.style.Theme_Dialog); activity.requestWindowFeature(Window.FEATURE_NO_TITLE); Window win = activity.getWindow(); win.setBackgroundDrawableResource(resId); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.requestWindowFeature(Window.FEATURE_NO_TITLE); super.getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); super.setContentView(R.layout.sys_chgbg); chgbg_bg = (TextView) super.findViewById(R.id.chgbg_bg); chgbg_img = (ImageView) super.findViewById(R.id.chgbg_img); chgbg_img.setOnLongClickListener(this); Toast.makeText(this, "全屏设置", Toast.LENGTH_SHORT).show(); }
private void showAsPopup(Activity activity) { activity.requestWindowFeature(Window.FEATURE_ACTION_BAR); activity .getWindow() .setFlags( WindowManager.LayoutParams.FLAG_DIM_BEHIND, WindowManager.LayoutParams.FLAG_DIM_BEHIND); LayoutParams params = activity.getWindow().getAttributes(); params.height = LayoutParams.MATCH_PARENT; params.width = 850; // fixed width params.alpha = 1.0f; params.dimAmount = 0.5f; activity.getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_main); responseTv = ((TextView) findViewById(R.id.response_msg)); edUserName = ((EditText) findViewById(R.id.uname)); edMessage = ((EditText) findViewById(R.id.message)); buildSpinnerLayout(); App42API.initialize(this, "Your API Key", "Your Secret Key"); App42Log.setDebug(true); // UserName You want to register on App42 App42API.setLoggedInUser("YourUserName"); }
@Override protected void onCreate(Bundle bundle) { super.requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(bundle); startService(new Intent(this, RucksackService.class)); mHandler = new Handler(new MessageProcessor()); mWaitDialog = new WaitDialog(this); mDeviceDialog = new DeviceDialog(this, mHandler.obtainMessage(ACTION_DEVICE_SELECTED)); mRootPasswordDialog = new RootPasswordDialog(this, mHandler.obtainMessage(ACTION_PASSWORD_INPUTED)); mRootPasswordStorage = getSharedPreferences("password-storage", MODE_APPEND); mViewFramework = new ViewFramework(this); mViewFramework.addSettingGroup("网络"); mViewFramework.addSettingItem(new ConfigureNetwork(this)); mViewFramework.addSettingGroup("服务"); mViewFramework.addSettingItem(new ConfigureWebService(this)); mViewFramework.addSettingItem(new ConfigureFtpService(this)); mViewFramework.addSettingItem(new ConfigureDlnaService(this)); mViewFramework.addSettingItem(new ConfigureDdnsService(this)); mViewFramework.addSettingItem(new ConfigureProxyService(this)); mViewFramework.addSettingItem(new ConfigureSambaService(this)); mViewFramework.addSettingGroup("密码"); mViewFramework.addSettingItem(new ConfigurePassword(this, "root")); mViewFramework.addSettingItem(new ConfigurePassword(this, "share")); mViewFramework.addSettingItem(new ConfigurePassword(this, "guest")); mViewFramework.addSettingGroup("日期和时间"); mViewFramework.addSettingItem(new ConfigureTime(this, ConfigureTime.Source.DEVICE)); mViewFramework.addSettingItem(new ConfigureTime(this, ConfigureTime.Source.NETWORK)); mViewFramework.addSettingGroup("系统"); mViewFramework.addSettingItem(new ConfigureHostname(this)); mViewFramework.addSettingItem(new ConfigureStorage(this)); mViewFramework.addSettingItem(new ConfigureService(this)); mViewFramework.addSettingItem(new ConfigureProcess(this)); mViewFramework.addSettingItem(new ConfigureAbout(this)); mViewFramework.addFunctionItem(new FunctionFilesystem(this)); mViewFramework.addFunctionItem(new FunctionDownloader(this)); mViewFramework.addFunctionItem(new FunctionPlayer(this)); setContentView(mViewFramework); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.requestWindowFeature(Window.FEATURE_NO_TITLE); // 设置无标题窗口 super.getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // 全屏模式 super.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); // 强制为横屏 this.setContentView(R.layout.yooxicafe_goodslist); Intent intent = this.getIntent(); String goodsid = intent.getStringExtra("goodsid"); Cursor c = dbhelper.queryByParamgoodsid(dbhelper.GOODS_TM_NAME, goodsid); try { goodslists = jmGoodsListAction.getGoodsListSQLiteNoZip(c); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } c.close(); if (!goodslists.isEmpty()) { holder.setGoodsimage((ImageView) this.findViewById(R.id.goodsimage)); holder.setGoodsname((TextView) this.findViewById(R.id.goodsname)); holder.setWeight((TextView) this.findViewById(R.id.valueweight)); holder.setUnitname((TextView) this.findViewById(R.id.unitname)); holder.setMemberprice((TextView) this.findViewById(R.id.memberprice)); holder.setDetail((TextView) this.findViewById(R.id.goodsdetail)); holder.getGoodsimage().setImageBitmap((Bitmap) goodslists.get(0).get("pictureurl")); holder.getGoodsname().setText(goodslists.get(0).get("goodsname").toString()); holder.getMemberprice().setText(goodslists.get(0).get("memberprice").toString()); holder.getUnitname().setText(goodslists.get(0).get("unitname").toString()); holder.getWeight().setText(goodslists.get(0).get("weight").toString()); } // 处理返回事件响应 getback = (TextView) this.findViewById(R.id.getback); getback.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { finish(); } }); // 处理加入餐车事件 countplus = (TextView) this.findViewById(R.id.countplus); countplus.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { addtoCart(goodslists, 0); } }); // 查看已选 checkselected = (TextView) this.findViewById(R.id.checkselected); checkselected.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { setElecartListView(); } }); }
/** * 隐藏标题 * * @param activity 要隐藏标题的activity */ public static void hideTitleBar(Activity activity) { activity.requestWindowFeature(Window.FEATURE_NO_TITLE); }
/** * 隐藏状态栏 * * <p>也就是设置全屏,一定要在setContentView之前调用,否则报错 * * <p>此方法Activity可以继承AppCompatActivity * * <p>启动的时候状态栏会显示一下再隐藏,比如QQ的欢迎界面 * * <p>在配置文件中Activity加属性android:theme="@android:style/Theme.NoTitleBar.Fullscreen" * * <p>如加了以上配置Activity不能继承AppCompatActivity,会报错 * * @param activity activity */ public static void hideStatusBar(Activity activity) { activity.requestWindowFeature(Window.FEATURE_NO_TITLE); activity.getWindow().setFlags(LayoutParams.FLAG_FULLSCREEN, LayoutParams.FLAG_FULLSCREEN); }