本文整理汇总了Java中android.widget.PopupWindow.setAnimationStyle方法的典型用法代码示例。如果您正苦于以下问题:Java PopupWindow.setAnimationStyle方法的具体用法?Java PopupWindow.setAnimationStyle怎么用?Java PopupWindow.setAnimationStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.PopupWindow
的用法示例。
在下文中一共展示了PopupWindow.setAnimationStyle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import android.widget.PopupWindow; //导入方法依赖的package包/类
public static PopupWindow create(@NonNull Context context, @NonNull BubbleLayout bubbleLayout) {
PopupWindow popupWindow = new PopupWindow(context);
popupWindow.setContentView(bubbleLayout);
popupWindow.setOutsideTouchable(true);
popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setAnimationStyle(android.R.style.Animation_Dialog);
// change background color to transparent
Drawable drawable;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
drawable = context.getDrawable(R.drawable.popup_window_transparent);
} else {
drawable = context.getResources().getDrawable(R.drawable.popup_window_transparent);
}
popupWindow.setBackgroundDrawable(drawable);
return popupWindow;
}
示例2: ListFilePopWindow
import android.widget.PopupWindow; //导入方法依赖的package包/类
public ListFilePopWindow(Context context, View targetView) {
super();
this.targetView = targetView;
View contentView = LayoutInflater.from(context).inflate(R.layout.kf5_list_file_dir, null);
listView = (ListView) contentView.findViewById(R.id.kf5_list_dir);
Point point = ScreenUtils.getScreenSize(context);
int height = (int) (point.y * (4.5f / 8.0f));
popupWindow = new PopupWindow();
popupWindow.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
popupWindow.setHeight(height);
popupWindow.setBackgroundDrawable(new BitmapDrawable());
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(true);
popupWindow.setTouchable(true);
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
// TODO Auto-generated method stub
popupWindow.dismiss();
}
});
popupWindow.setAnimationStyle(R.style.KF5FileListPopAnim);
popupWindow.setContentView(contentView);
listView.setOnItemClickListener(this);
}
示例3: onClick
import android.widget.PopupWindow; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
PopupWindow win=window.getPopupWindow();
switch (v.getId()) {
case R.id.translate_bt:
win.setAnimationStyle(R.style.animTranslate);
break;
case R.id.alpha_bt:
win.setAnimationStyle(R.style.animAlpha);
break;
case R.id.scale_bt:
win.setAnimationStyle(R.style.animScale);
break;
case R.id.rotate_bt:
win.setAnimationStyle(R.style.animRotate);
break;
default:break;
}
window.showAtLocation(activityPopup, Gravity.BOTTOM, 0, 0);
WindowManager.LayoutParams lp=getWindow().getAttributes();
lp.alpha=0.3f;
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
getWindow().setAttributes(lp);
}
示例4: PicPopupWindow
import android.widget.PopupWindow; //导入方法依赖的package包/类
private PicPopupWindow(Context context) {
mContext = context;
mInflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mPopupContent = (ViewGroup) mInflater.inflate(
R.layout.popup_window_list, null);
mPopupItemContent = (ViewGroup) mPopupContent
.findViewById(R.id.popup_window_item_content);
title = (TextView) mPopupContent
.findViewById(R.id.popup_window_title_text);
mPopupWindow = new PopupWindow(mPopupContent,
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
mPopupWindow.setFocusable(true);
mPopupWindow.setBackgroundDrawable(new BitmapDrawable());
mPopupWindow.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
// TODO Auto-generated method stub
resetItemByTag(setTag);
if (mAnimationListener != null) {
mAnimationListener.doAnimation(false);
}
}
});
mPopupWindow.setAnimationStyle(R.style.popup_window_animation);
}
示例5: initPopupWindow
import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
* 初始化显示文件夹信息的popupWindow
*/
private void initPopupWindow() {
popRecyclerview = new RecyclerView(this);
popRecyclerview.setBackgroundColor(getResources().getColor(android.R.color.white));
LinearLayoutManager layoutManager = new LinearLayoutManager
(this, LinearLayoutManager.VERTICAL, false);
popRecyclerview.setLayoutManager(layoutManager);
popRecyclerview.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
popRecyclerview.setPadding(0, Commonutil.dp2px(this, 5), 0, 0);
int screenHeight = getResources().getDisplayMetrics().heightPixels;
popupWindow = new PopupWindow(popRecyclerview, ViewGroup.LayoutParams.MATCH_PARENT,
(int) (screenHeight * 0.6f));
popupWindow.setBackgroundDrawable(new BitmapDrawable());
popupWindow.setFocusable(true);
popupWindow.setOutsideTouchable(false);
popupWindow.setAnimationStyle(R.style.popup_anim);
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
fab.setVisibility(View.VISIBLE);
WindowManager.LayoutParams attributes =
ScanImagesActivity.this.getWindow().getAttributes();
attributes.alpha = 1;
ScanImagesActivity.this.getWindow().setAttributes(attributes);
}
});
}
示例6: initStokeWidthPopWindow
import android.widget.PopupWindow; //导入方法依赖的package包/类
private void initStokeWidthPopWindow() {
popView = LayoutInflater.from(activity).
inflate(R.layout.view_set_stoke_width, null);
setStokenWidthWindow = new PopupWindow(popView, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
mStokenWidthSeekBar = (SeekBar) popView.findViewById(R.id.stoke_width_seekbar);
setStokenWidthWindow.setFocusable(true);
setStokenWidthWindow.setOutsideTouchable(true);
setStokenWidthWindow.setBackgroundDrawable(new BitmapDrawable());
setStokenWidthWindow.setAnimationStyle(R.style.popwin_anim_style);
mPaintModeView.setPaintStrokeColor(Color.RED);
mPaintModeView.setPaintStrokeWidth(10);
updatePaintView();
}
示例7: initCirclePop
import android.widget.PopupWindow; //导入方法依赖的package包/类
private void initCirclePop() {
View view = LayoutInflater.from(this).inflate(R.layout.layout_circle_comment, null);
mCiclePop = new PopupWindow(view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mCiclePop.setAnimationStyle(R.style.CirclePopAnim);
mCiclePop.setFocusable(true);
mCiclePop.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mCiclePop.setOutsideTouchable(true);
}
示例8: initQQPop
import android.widget.PopupWindow; //导入方法依赖的package包/类
private void initQQPop() {
View view = LayoutInflater.from(this).inflate(R.layout.layout_right_pop, null);
mQQPop = new PopupWindow(view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mQQPop.setAnimationStyle(R.style.QQPopAnim);
mQQPop.setFocusable(true);
mQQPop.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mQQPop.setOutsideTouchable(true);
}
示例9: initWeiboPop
import android.widget.PopupWindow; //导入方法依赖的package包/类
private void initWeiboPop() {
View view = LayoutInflater.from(this).inflate(R.layout.layout_center_pop, null);
mWeiboPop = new PopupWindow(view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mWeiboPop.setAnimationStyle(R.style.WeiboPopAnim);
mWeiboPop.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mWeiboPop.setFocusable(true);
mWeiboPop.setOutsideTouchable(false);
}
示例10: CandidateView
import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
* Construct a CandidateView for showing suggested words for completion.
* @param context
* @param attrs
*/
public CandidateView(Context context, AttributeSet attrs) {
super(context, attrs);
mSelectionHighlight = context.getResources().getDrawable(
R.drawable.list_selector_background_pressed);
LayoutInflater inflate =
(LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Resources res = context.getResources();
mPreviewPopup = new PopupWindow(context);
mPreviewText = (TextView) inflate.inflate(R.layout.candidate_preview, null);
mPreviewPopup.setWindowLayoutMode(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
mPreviewPopup.setContentView(mPreviewText);
mPreviewPopup.setBackgroundDrawable(null);
mPreviewPopup.setAnimationStyle(R.style.KeyPreviewAnimation);
mColorNormal = res.getColor(R.color.candidate_normal);
mColorRecommended = res.getColor(R.color.candidate_recommended);
mColorOther = res.getColor(R.color.candidate_other);
mDivider = res.getDrawable(R.drawable.keyboard_suggest_strip_divider);
mAddToDictionaryHint = res.getString(R.string.hint_add_to_dictionary);
mPaint = new Paint();
mPaint.setColor(mColorNormal);
mPaint.setAntiAlias(true);
mPaint.setTextSize(mPreviewText.getTextSize());
mPaint.setStrokeWidth(0);
mPaint.setTextAlign(Align.CENTER);
mDescent = (int) mPaint.descent();
mMinTouchableWidth = (int)res.getDimension(R.dimen.candidate_min_touchable_width);
mGestureDetector = new GestureDetector(
new CandidateStripGestureListener(mMinTouchableWidth));
setWillNotDraw(false);
setHorizontalScrollBarEnabled(false);
setVerticalScrollBarEnabled(false);
scrollTo(0, getScrollY());
}
示例11: CustomPopupWindow
import android.widget.PopupWindow; //导入方法依赖的package包/类
private CustomPopupWindow(Builder builder) {
if (builder.contentViewId == 0 || builder.width == 0 || builder.height == 0) {
throw new IllegalArgumentException("The parameter is incomplete, be sure to contain contentView, width and height.");
}
mContext = builder.context;
mContentView = LayoutInflater.from(mContext).inflate(builder.contentViewId, null);
mPopupWindow = new PopupWindow(mContentView, builder.width, builder.height, builder.focus);
if (Build.VERSION.SDK_INT >= 21) mPopupWindow.setElevation(builder.elevation);
mPopupWindow.setOutsideTouchable(builder.outsideCancel);
mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mPopupWindow.setAnimationStyle(builder.animStyle);
}
示例12: initmPopupWindowFunctionListView
import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
* 编辑页功能清单
* 提醒、清单、发送、查找、详情、删除
*/
private void initmPopupWindowFunctionListView() {
View customView = getLayoutInflater().inflate(R.layout.item_note_edit_popup, null, false);
// 创建PopupWindow实例,设置宽度和高度
FunctionPopup = new PopupWindow(customView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
FunctionPopup.setAnimationStyle(R.style.AnimationFade);
FunctionPopup.showAsDropDown(customView);
customView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (FunctionPopup != null && FunctionPopup.isShowing()) {
FunctionPopup.dismiss();
FunctionPopup = null;
}
return false;
}
});
TextView tv_note_remind = (TextView) customView.findViewById(R.id.tv_note_remind);
TextView tv_note_list = (TextView) customView.findViewById(R.id.tv_note_list);
TextView tv_note_send = (TextView) customView.findViewById(R.id.tv_note_send);
TextView tv_note_select = (TextView) customView.findViewById(R.id.tv_note_select);
TextView tv_note_detail = (TextView) customView.findViewById(R.id.tv_note_detail);
TextView tv_note_delete = (TextView) customView.findViewById(R.id.tv_note_delete);
tv_note_remind.setOnClickListener(this);
tv_note_list.setOnClickListener(this);
tv_note_send.setOnClickListener(this);
tv_note_select.setOnClickListener(this);
tv_note_detail.setOnClickListener(this);
tv_note_delete.setOnClickListener(this);
}
示例13: dialog
import android.widget.PopupWindow; //导入方法依赖的package包/类
public static PopupWindow dialog(View dialogView, int gravity, int anim, int x, int y, int width, int heigh) {
if (dialogView == null) {
throw new NullPointerException("dialogView is null from method:dialog Class:DialogUtils");
}
PopupWindow popup = new PopupWindow(dialogView, width, heigh);
if (anim != 0) {
popup.setAnimationStyle(anim);
}
popup.setBackgroundDrawable(new BitmapDrawable());
popup.setOutsideTouchable(true);
popup.showAtLocation(dialogView, gravity, x, y);
return popup;
}
示例14: startShowDialog
import android.widget.PopupWindow; //导入方法依赖的package包/类
private void startShowDialog() {
View popMenuView = activity.getLayoutInflater().inflate(R.layout.dialog, null);
RealTimeBlurView blur_view = (RealTimeBlurView) popMenuView.findViewById(R.id.blur_view);
float v = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, activity.getResources().getDisplayMetrics());
blur_view.setBlurRadius(v);
final PopupWindow popMenu = new PopupWindow(popMenuView, RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT, true);
popMenu.setClippingEnabled(false);
popMenu.setFocusable(true); //点击其他地方关闭
popMenu.setAnimationStyle(R.style.main_menu_animstyle);
popMenu.showAtLocation(popMenuView, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
}
示例15: showPopupWindow
import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
* 把一个View控件添加到PopupWindow上并且显示
*
* @param activity
*/
public void showPopupWindow(Activity activity) {
popupWindow = new PopupWindow(mMenuView, // 添加到popupWindow
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
// ☆ 注意: 必须要设置背景,播放动画有一个前提 就是窗体必须有背景
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
popupWindow.showAtLocation(activity.getWindow().getDecorView(), Gravity.CENTER | Gravity.BOTTOM, 0, 0);
popupWindow.setAnimationStyle(android.R.style.Animation_InputMethod); // 设置窗口显示的动画效果
popupWindow.setFocusable(false); // 点击其他地方隐藏键盘 popupWindow
popupWindow.update();
}