android.app.Activity.requestWindowFeature()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(199)

本文整理了Java中android.app.Activity.requestWindowFeature()方法的一些代码示例,展示了Activity.requestWindowFeature()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.requestWindowFeature()方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:requestWindowFeature

Activity.requestWindowFeature介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public static void showAsPopup(Activity activity) {
  //To show activity as dialog and dim the background, you need to declare android:theme="@style/PopupTheme" on for the chosen activity on the manifest
  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 = 850; //fixed height
  params.width = 850; //fixed width
  params.alpha = 1.0f;
  params.dimAmount = 0.5f;
  activity.getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); 
  setContentView(R.layout.activity_main);
}

代码示例来源:origin: stackoverflow.com

private void showAsPopup(Activity activity) {
  //To show activity as dialog and dim the background, you need to declare android:theme="@style/PopupTheme" on for the chosen activity on the manifest
  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.alpha = 1.0f;
  params.dimAmount = 0f;
  activity.getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); 

  // This sets the window size, while working around the IllegalStateException thrown by ActionBarView
  activity.getWindow().setLayout(850,850);
}

代码示例来源:origin: jinguangyue/Android-CustomCamera

/**
 * 隐藏Activity的系统默认标题栏
 *
 * @param activity Activity
 */
public static void hideTitleBar(Activity activity) {
  activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
}

代码示例来源:origin: luhaoaimama1/zone-sdk

/**
 * 必须在 setContentView 之前用 否则无效!
 */
public void setNoTitle() {
  //设置无标题
  activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
}

代码示例来源:origin: com.albedinsky.android/fragments

@Override
  boolean requestWindowFeature(int featureId) {
    return mActivity.requestWindowFeature(featureId);
  }
}

代码示例来源:origin: com.albedinsky.android.support/support-fragments

@Override
  boolean requestWindowFeature(int featureId) {
    return mActivity.requestWindowFeature(featureId);
  }
}

代码示例来源:origin: com.uphyca/android-junit4-robolectric

/**
 * @param featureId
 * @return
 * @see android.app.Activity#requestWindowFeature(int)
 */
public final boolean requestWindowFeature(int featureId) {
  return mActivity.requestWindowFeature(featureId);
}

代码示例来源:origin: luhaoaimama1/zone-sdk

public static void  requestNoTitle(Activity context){
  context.requestWindowFeature(Window.FEATURE_NO_TITLE);
}

代码示例来源:origin: stackoverflow.com

public void hideBars(Activity activity)
{
  //HIDING TOP TITLE TAB
  activity.requestWindowFeature(Window.FEATURE_NO_TITLE);

  //HIDING TOP TOOL BAR
  activity.getWindow().setFlags(
      WindowManager.LayoutParams.FLAG_FULLSCREEN,
      WindowManager.LayoutParams.FLAG_FULLSCREEN);

}

代码示例来源:origin: stackoverflow.com

public class SendItemsFragment extends Fragment {
  private Activity activity;
  public SendItemsFragment (Activity act) {
    this.activity = act;
  }

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
     activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
     View rootView = inflater.inflate(R.layout.send_items, container, false);
     return rootView;
  }
}

代码示例来源:origin: wasdennnoch/AndroidN-ify

@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
  Activity activity = (Activity) param.thisObject;
  activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
}

代码示例来源:origin: stackoverflow.com

public static void showAsPopup(Activity activity) {
   //To show activity as dialog and dim the background, you need to declare android:theme="@style/PopupTheme" on for the chosen activity on the manifest
   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.FILL_PARENT;
   params.width = 850; //fixed width
   params.alpha = 1.0f;
   params.dimAmount = 0.5f;
   activity.getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); 
 }

代码示例来源:origin: luhaoaimama1/zone-sdk

public static void  requestFillWindow(Activity context){
  context.requestWindowFeature(Window.FEATURE_NO_TITLE);
  context.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
public static void  requestNoTitle(Activity context){

代码示例来源:origin: 0xm1nam0/RxCore

/**
 * 隐藏状态栏
 * <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);
}

代码示例来源:origin: stackoverflow.com

public static void showAsPopup(Activity activity) {
  //To show activity as dialog and dim the background, you need to declare android:theme="@style/PopupTheme" on for the chosen activity on the manifest
  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 = 850; //fixed height
  params.width = 850; //fixed width
  params.alpha = 1.0f;
  params.dimAmount = 0.5f;
  activity.getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); 
  setContentView(R.layout.activity_main);
}

代码示例来源:origin: stackoverflow.com

private void showAsPopup(Activity activity) {
  //To show activity as dialog and dim the background, you need to declare android:theme="@style/PopupTheme" on for the chosen activity on the manifest
  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.alpha = 1.0f;
  params.dimAmount = 0f;
  activity.getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); 

  // This sets the window size, while working around the IllegalStateException thrown by ActionBarView
  activity.getWindow().setLayout(850,850);
}

代码示例来源:origin: stackoverflow.com

public static void showAsPopup(Activity activity) {
  //To show activity as dialog and dim the background, you need to declare   android:theme="@style/PopupTheme" on for the chosen activity on the manifest
 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 = 850; //fixed height
 params.width = 850; //fixed width
 params.alpha = 1.0f;
 params.dimAmount = 0.5f;
 activity.getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); 
 setContentView(R.layout.activity_main);
}

代码示例来源:origin: termux/termux-api

void initActivityDisplay(Activity activity) {
  activity.setFinishOnTouchOutside(false);
  activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
}

代码示例来源:origin: 296777513/pedometer

public void setActivity(Activity activity) {
  super.setActivity(activity);
  if (dialogMode) {
    activity.setTheme(android.R.style.Theme_Dialog);
    activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
  }
  activity.getWindow().setSoftInputMode(
        WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}

代码示例来源:origin: fengmaolian/LoginAndShare

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);
  }
}

相关文章

Activity类方法