android.view.Window.setWindowAnimations()方法的使用及代码示例

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

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

Window.setWindowAnimations介绍

暂无

代码示例

代码示例来源:origin: gzu-liyujiang/AndroidPicker

public void setAnimationStyle(@StyleRes int animRes) {
  Window window = dialog.getWindow();
  if (window != null) {
    window.setWindowAnimations(animRes);
  }
}

代码示例来源:origin: jeasonlzy/NineGridView

@Override
  public void show() {
    getWindow().setWindowAnimations(R.style.dialog_anim);
    super.show();
  }
}

代码示例来源:origin: Bigkoo/Android-PickerView

public void createDialog() {
  if (dialogView != null) {
    mDialog = new Dialog(context, R.style.custom_dialog2);
    mDialog.setCancelable(mPickerOptions.cancelable);//不能点外面取消,也不能点back取消
    mDialog.setContentView(dialogView);
    Window dialogWindow = mDialog.getWindow();
    if (dialogWindow != null) {
      dialogWindow.setWindowAnimations(R.style.picker_view_scale_anim);
      dialogWindow.setGravity(Gravity.CENTER);//可以改成Bottom
    }
    mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
      @Override
      public void onDismiss(DialogInterface dialog) {
        if (onDismissListener != null) {
          onDismissListener.onDismiss(BasePickerView.this);
        }
      }
    });
  }
}

代码示例来源:origin: aa112901/remusic

switch (animation) {
  case SLIDE_LEFT:
    window.setWindowAnimations(R.style.dialog_anim_slide_left);
    break;
  case SLIDE_UP:
    window.setWindowAnimations(R.style.dialog_anim_slide_up);
    break;
  case FADE_OUT:
    window.setWindowAnimations(R.style.dialog_anim_fade_out);
    break;

代码示例来源:origin: H07000223/FlycoDialog_Master

/** dialog anim by styles(动画弹出对话框,style动画资源) */
public void show(int animStyle) {
  Window window = getWindow();
  window.setWindowAnimations(animStyle);
  show();
}

代码示例来源:origin: aa112901/remusic

switch (animation) {
  case SLIDE_LEFT:
    window.setWindowAnimations(R.style.dialog_anim_slide_left);
    break;
  case SLIDE_UP:
    window.setWindowAnimations(R.style.dialog_anim_slide_up);
    break;
  case FADE_OUT:
    window.setWindowAnimations(R.style.dialog_anim_fade_out);
    break;

代码示例来源:origin: aa112901/remusic

switch (animation) {
  case SLIDE_LEFT:
    window.setWindowAnimations(R.style.dialog_anim_slide_left);
    break;
  case SLIDE_UP:
    window.setWindowAnimations(R.style.dialog_anim_slide_up);
    break;
  case FADE_OUT:
    window.setWindowAnimations(R.style.dialog_anim_fade_out);
    break;

代码示例来源:origin: Rukey7/MvpApp

Window window = getDialog().getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
window.setWindowAnimations(R.style.AnimateDialog);
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
View view = inflater.inflate(R.layout.dialog_share, container);

代码示例来源:origin: jeasonlzy/ImagePicker

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  View view = getLayoutInflater().inflate(R.layout.view_dialog_select,
      null);
  setContentView(view, new LayoutParams(LayoutParams.FILL_PARENT,
      LayoutParams.WRAP_CONTENT));
  Window window = getWindow();
  // 设置显示动画
  window.setWindowAnimations(R.style.main_menu_animstyle);
  WindowManager.LayoutParams wl = window.getAttributes();
  wl.x = 0;
  wl.y = mActivity.getWindowManager().getDefaultDisplay().getHeight();
  // 以下这两句是为了保证按钮可以水平满屏
  wl.width = LayoutParams.MATCH_PARENT;
  wl.height = LayoutParams.WRAP_CONTENT;
  // 设置显示位置
  onWindowAttributesChanged(wl);
  initViews();
}

代码示例来源:origin: north2016/T-MVP

public void reload() {
  AppCompatDelegate.setDefaultNightMode(SpUtil.isNight() ? AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO);
  getWindow().setWindowAnimations(R.style.WindowAnimationFadeInOut);
  recreate();
}

代码示例来源:origin: iMeiji/Toutiao

AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
getWindow().setWindowAnimations(R.style.WindowAnimationFadeInOut);
recreate();
return false;

代码示例来源:origin: zaaach/CityPicker

@Override
public void onStart() {
  super.onStart();
  Dialog dialog = getDialog();
  dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
    @Override
    public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
      if (keyCode == KeyEvent.KEYCODE_BACK){
        if (mOnPickListener != null){
          mOnPickListener.onCancel();
        }
      }
      return false;
    }
  });
  measure();
  Window window = dialog.getWindow();
  if (window != null) {
    window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
    window.setGravity(Gravity.BOTTOM);
    window.setLayout(width, height - ScreenUtil.getStatusBarHeight(getActivity()));
    if (enableAnim) {
      window.setWindowAnimations(mAnimStyle);
    }
  }
}

代码示例来源:origin: Bigkoo/Android-PickerView

dialogWindow.setWindowAnimations(com.bigkoo.pickerview.R.style.picker_view_slide_anim);//修改动画样式

代码示例来源:origin: chaychan/TouTiao

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  Dialog dialog = getDialog();
  if (dialog != null) {
    //添加动画
    dialog.getWindow().setWindowAnimations(R.style.dialogSlideAnim);
  }
  return inflater.inflate(R.layout.fragment_channel, null);
}

代码示例来源:origin: iielse/ImageWatcher

public SheetDialog create() {
  final SheetDialog dialog = new SheetDialog(p.context, shadow ? R.style.Theme_Light_NoTitle_Dialog : R.style.Theme_Light_NoTitle_NoShadow_Dialog);
  Window window = dialog.getWindow();
  window.setWindowAnimations(R.style.Animation_Bottom_Rising);
  window.getDecorView().setPadding(0, 0, 0, 0);
  WindowManager.LayoutParams lp = window.getAttributes();

代码示例来源:origin: kaku2015/ColorfulNews

@Override
      public void onDrawerClosed(View drawerView) {
        super.onDrawerClosed(drawerView);
        if (mClass != null) {
          Intent intent = new Intent(BaseActivity.this, mClass);
          // 此标志用于启动一个Activity的时候,若栈中存在此Activity实例,则把它调到栈顶。不创建多一个
//                    intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
          startActivity(intent);
          overridePendingTransition(0, 0);
          mClass = null;
        }

        if (mIsChangeTheme) {
          mIsChangeTheme = false;
          getWindow().setWindowAnimations(R.style.WindowAnimationFadeInOut);
          recreate();
        }
      }
    });

代码示例来源:origin: yanjiabin/ExtendDialog

/**
 * 从底部一直弹到中间
 */
@SuppressLint("NewApi")
public ExtendsDialog fromBottomToMiddle() {
  mDialogWindow.setWindowAnimations(R.style.window_bottom_in_bottom_out);
  return this;
}

代码示例来源:origin: smuyyh/SprintNBA

/** dialog anim by styles(动画弹出对话框,style动画资源) */
public void show(int animStyle) {
  Window window = getWindow();
  window.setWindowAnimations(animStyle);
  show();
}

代码示例来源:origin: fangx/ZhiHuMVP

private void init() {
  Window window = this.getWindow();
  window.setGravity(Gravity.CENTER); // 此处可以设置dialog显示的位置
  window.setWindowAnimations(R.style.stagedialogstyle); // 添加动画
}

代码示例来源:origin: 736008081/uploadPhoto

public PhotoSelectDialog(Activity activity) {
  super(activity, R.style.photoDialog);
  this.mActivity = activity;
  initView();
  getWindow().setGravity(Gravity.BOTTOM); // 此处可以设置dialog显示的位置
  getWindow().setWindowAnimations(R.style.photoDialogAnimation); // 添加动画
  WindowManager windowManager = activity.getWindowManager();
  Display display = windowManager.getDefaultDisplay();
  WindowManager.LayoutParams lp = getWindow().getAttributes();
  lp.width = display.getWidth(); // 设置宽度
  getWindow().setAttributes(lp);
}

相关文章

Window类方法