本文整理汇总了Java中android.app.Activity.requestWindowFeature方法的典型用法代码示例。如果您正苦于以下问题:Java Activity.requestWindowFeature方法的具体用法?Java Activity.requestWindowFeature怎么用?Java Activity.requestWindowFeature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.Activity
的用法示例。
在下文中一共展示了Activity.requestWindowFeature方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setActivity
import android.app.Activity; //导入方法依赖的package包/类
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);
}
}
示例2: attachToActivity
import android.app.Activity; //导入方法依赖的package包/类
/**
* 将SwipeFinishLayout关联到指定activity中
* @param activity
*/
public void attachToActivity(Activity activity) {
mActivity = activity;
TypedArray ta = activity.getTheme().obtainStyledAttributes(
new int[] {android.R.attr.windowBackground});
int background = ta.getResourceId(0, 0);
ta.recycle();
// 设置window样式,FEATURE_NO_TITLE
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
// 系统内置,/platforms/android-25/data/res/layout/screen_custom_title.xml
ViewGroup decorChild = (ViewGroup) decorView.getChildAt(0);
decorChild.setBackgroundResource(background);
decorView.removeView(decorChild);
addView(decorChild);
// 设置content view
mContentView = (View) decorChild.getParent();
// 将SwipeFinishLayout添加到decorView中
decorView.addView(this);
}
示例3: setActivity
import android.app.Activity; //导入方法依赖的package包/类
public void setActivity(Activity activity) {
super.setActivity(activity);
int resId = R.getBitmapRes(activity, "ssdk_oks_shake_to_share_back");
if (resId > 0) {
activity.setTheme(16973835);
activity.requestWindowFeature(1);
activity.getWindow().setBackgroundDrawableResource(resId);
}
}
示例4: open
import android.app.Activity; //导入方法依赖的package包/类
public static void open(final Activity activity, String imageUrl, final OnWelcomeDone onWelcomeDone) {
activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
final View welcome = LayoutInflater.from(activity).inflate(R.layout.welcome, null);
final AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
alphaAnimation.setDuration(1000);
welcome.startAnimation(alphaAnimation);
Glide.with(activity).load(imageUrl).into(((ImageView) welcome.findViewById(R.id.iv_welcome)));
activity.setContentView(welcome);
final TextView skipView = (TextView) welcome.findViewById(R.id.tv_skip);
final CountDownTimer start = new CountDownTimer(5000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
skipView.setText("跳过" + ((millisUntilFinished / 1000) - 1));
}
@Override
public void onFinish() {
AlphaAnimation alphaAnimation1 = new AlphaAnimation(1.0f, 0.0f);
alphaAnimation1.setDuration(1000);
welcome.startAnimation(alphaAnimation1);
if (onWelcomeDone != null) {
onWelcomeDone.onDone();
}
}
}.start();
skipView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
start.onFinish();
}
});
}
示例5: setAllScreen
import android.app.Activity; //导入方法依赖的package包/类
/**
* 设置全屏
*/
public static void setAllScreen(Activity activity) {
activity.requestWindowFeature(Window.FEATURE_NO_TITLE); //无title
activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN); //全屏
}
示例6: hideStatusBar
import android.app.Activity; //导入方法依赖的package包/类
/**
* 隐藏状态栏
* <p>也就是设置全屏,一定要在setContentView之前调用,否则报错</p>
* <p>此方法Activity可以继承AppCompatActivity</p>
* <p>启动的时候状态栏会显示一下再隐藏,比如QQ的欢迎界面</p>
* <p>在配置文件中Activity加属性android:theme="@android:style/Theme.NoTitleBar.Fullscreen"</p>
* <p>如加了以上配置Activity不能继承AppCompatActivity,会报错</p>
*
* @param activity activity
*/
public static void hideStatusBar(Activity activity)
{
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
示例7: setFullScreen
import android.app.Activity; //导入方法依赖的package包/类
/**
* 设置屏幕为全屏
* <p>需在 {@code setContentView} 之前调用</p>
*
* @param activity activity
*/
public static void setFullScreen(@NonNull final Activity activity) {
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
示例8: hideStatusBar
import android.app.Activity; //导入方法依赖的package包/类
/**
* 隐藏状态栏
* <p>也就是设置全屏,一定要在setContentView之前调用,否则报错</p>
* <p>此方法Activity可以继承AppCompatActivity</p>
* <p>启动的时候状态栏会显示一下再隐藏,比如QQ的欢迎界面</p>
* <p>在配置文件中Activity加属性android:theme="@android:style/Theme.NoTitleBar.Fullscreen"</p>
* <p>如加了以上配置Activity不能继承AppCompatActivity,会报错</p>
*
* @param activity activity
*/
public static void hideStatusBar(Activity activity) {
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
示例9: hideTitleBar
import android.app.Activity; //导入方法依赖的package包/类
/**
* </br><b>title : </b> 隐藏系统标题栏
* </br><b>description :</b>隐藏Activity的系统默认标题栏
*
* @param activity Activity对象
*/
public static void hideTitleBar(Activity activity) {
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
}
示例10: hideStatusBar
import android.app.Activity; //导入方法依赖的package包/类
/**
* 隐藏状态栏
* <p>也就是设置全屏,一定要在setContentView之前调用,否则报错</p>
* <p>此方法Activity可以继承AppCompatActivity</p>
* <p>启动的时候状态栏会显示一下再隐藏,比如QQ的欢迎界面</p>
* <p>在配置文件中Activity加属性android:theme="@android:style/Theme.NoTitleBar.Fullscreen"</p>
* <p>如加了以上配置Activity不能继承AppCompatActivity,会报错</p>
*
* @param activity activity
*/
public static void hideStatusBar(Activity activity) {
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
activity.getWindow()
.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
示例11: hideStatusBar
import android.app.Activity; //导入方法依赖的package包/类
/**
* 隐藏状态栏
* <p>也就是设置全屏,一定要在setContentView之前调用,否则报错
* <p>此方法Activity可以继承AppCompatActivity
* <p>启动的时候状态栏会显示一下再隐藏,比如QQ的欢迎界面
* <p>在配置文件中Activity加属性android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
* <p>如加了以上配置Activity不能继承AppCompatActivity,会报错
*/
public static void hideStatusBar(Activity activity) {
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
activity.getWindow().setFlags(LayoutParams.FLAG_FULLSCREEN,
LayoutParams.FLAG_FULLSCREEN);
}