本文整理匯總了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);
}