java.awt.Window.setLayout()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(185)

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

Window.setLayout介绍

暂无

代码示例

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

myDialog.show();
Window window = myDialog.getWindow();
window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);

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

public void onResume()
{
  super.onResume();
  Window window = getDialog().getWindow();
  window.setLayout(width, height);
  window.setGravity(Gravity.CENTER);
  //TODO:
}

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

Window window = customdialog.getWindow();
window.setLayout(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
window.setGravity(Gravity.CENTER);

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

public void onResume() {
  super.onResume();

  Window window = getDialog().getWindow();
  Point size = new Point();

  Display display = window.getWindowManager().getDefaultDisplay();
  display.getSize(size);

  int width = size.x;

  window.setLayout((int) (width * 0.75), WindowManager.LayoutParams.WRAP_CONTENT);
  window.setGravity(Gravity.CENTER);
}

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

public void onActivityCreated(Bundle savedInstanceState)
{   
  super.onActivityCreated(savedInstanceState);
  Window window = getDialog().getWindow();
  LayoutParams attributes = window.getAttributes();
  //must setBackgroundDrawable(TRANSPARENT) in onActivityCreated()
  window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
  if (needFullScreen)
  {
    window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
  }
}

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

private void showPictureialog() {
  final Dialog dialog = new Dialog(this,
      android.R.style.Theme_Translucent_NoTitleBar);

  // Setting dialogview
  Window window = dialog.getWindow();
  window.setGravity(Gravity.CENTER);

  window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
  dialog.setTitle(null);
  dialog.setContentView(R.layout.selectpic_dialog);
  dialog.setCancelable(true);

  dialog.show();
}

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

@Override
  public void onResume()
  {
    super.onResume();
    Window window = getDialog().getWindow();
    window.setLayout(300, 300);
    window.setGravity(Gravity.CENTER);
}

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

dialog.show();
 dialog.setContentView(viewRoot);
 Window window = dialog.getWindow();
 window.setGravity(gravity);
 window.setLayout(measuredWidth, measuredHeight);

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

public void onResume()
{
  super.onResume();
  Window window = getDialog().getWindow();
  window.setLayout(width, height);
  window.setGravity(Gravity.CENTER);
  //TODO:
}

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

public void onResume(){
   super.onResume();
   Window window = getDialog().getWindow();
   window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);       
   window.setGravity(Gravity.CENTER);
 }

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

Window window = getWindow();
   DisplayMetrics metrics = getResources().getDisplayMetrics();
   window.setGravity(Gravity.CENTER);
   int width = (int) (metrics.widthPixels * 1);
   int height = (int) (metrics.heightPixels * .85);
   window.setLayout(height, width);

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

public void onResume() {
   super.onResume();
   super.onResume();
   Window window = getDialog().getWindow();
   window.setLayout(250, 100);
   window.setGravity(Gravity.RIGHT);
 }

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

@Override
public void onStart() {
  int dialogWidth = 800;
  int dialogHeight = LayoutParams.WRAP_CONTENT;
  Window window = getDialog().getWindow();
  window.setLayout(dialogWidth, dialogHeight);
  window.setGravity(Gravity.CENTER);
  super.onStart();
}

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

public void onActivityCreated(Bundle savedInstanceState)
{   
  Window window = getDialog().getWindow();
  LayoutParams attributes = window.getAttributes();
  //must setBackgroundDrawable(TRANSPARENT) in onActivityCreated()
  window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
  if (needFullScreen)
  {
    window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
  }
}

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

dialog = new Dialog(this, R.style.AlertDialogTheme);
dialog.setContentView(layout);
Window window = dialog.getWindow();
window.setLayout(
  (int)(window.getWindowManager().getDefaultDisplay().getWidth()  * .90),
  (int)(window.getWindowManager().getDefaultDisplay().getHeight() * .90 ));

dialog.setCancelable(false);

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

dialog = new Dialog(activity, android.R.style.Theme_Translucent_NoTitleBar);

dialog.setContentView(R.layout.activity_upload_photo_dialog);

Window window = dialog.getWindow();
window.setLayout(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
window.setGravity(Gravity.CENTER);

//The below code is EXTRA - to dim the parent view by 70%
LayoutParams lp = window.getAttributes();
lp.dimAmount = 0.7f;
lp.flags = LayoutParams.FLAG_DIM_BEHIND;
dialog.getWindow().setAttributes(lp);
//Show the dialog
dialog.show();

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

Dialog dialog = super.onCreateDialog(savedInstanceState);

WindowManager.LayoutParams lp = new WindowManager.LayoutParams();

Window window = dialog.getWindow();

if (window != null) {
   window.requestFeature(Window.FEATURE_NO_TITLE);
   window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
}

return dialog;

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

int DisplayWidth, DisplayHeight;
 Dialog dialog;
 Display display =((WindowManager)Your_context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
     DisplayWidth = display.getWidth();
     DisplayHeight = display.getHeight();
     dialog = new Dialog(activity_context);
      // Set your dialog width and height dynamically as per your screen.
     Window window = dialog.getWindow();
     window.setLayout(DisplayWidth , DisplayHeight);
     window.setGravity(Gravity.CENTER);
     dialog.show();

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

Dialog  dialog = new Dialog(context);
   dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
   dialog.setContentView(R.layout.dialog_friend_data);
   /*******************dialog features*********************/
   final Window window = dialog.getWindow();
   window.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
   window.setLayout(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT);
   window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
   window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
   dialog.show();

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

public MyCustomDialog(Context context) {
  super(context, android.R.style.Theme);

  Window window = getWindow();
  window.requestFeature(Window.FEATURE_NO_TITLE);
  window.setGravity(Gravity.BOTTOM);
  window.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.empty));

  setContentView(R.layout.my_custom_dialog);

  // actually not necessary as it's already the default value:
  window.setLayout(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

  ...
}

相关文章

Window类方法