本文整理汇总了Java中android.widget.PopupWindow.setElevation方法的典型用法代码示例。如果您正苦于以下问题:Java PopupWindow.setElevation方法的具体用法?Java PopupWindow.setElevation怎么用?Java PopupWindow.setElevation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.PopupWindow
的用法示例。
在下文中一共展示了PopupWindow.setElevation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: buildPopupWindow
import android.widget.PopupWindow; //导入方法依赖的package包/类
private PopupWindow buildPopupWindow(Activity parent) {
LayoutInflater inflater = (LayoutInflater) parent.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ViewGroup popupViewGroup = parent.findViewById(R.id.popup_layout);
View popupView = inflater.inflate(R.layout.progress_popup_window, popupViewGroup);
PopupWindow popupWindow = new PopupWindow(popupView, 750, 350, true);
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
popupWindow.setElevation(10);
popupWindow.setFocusable(false);
popupWindow.showAtLocation(popupView, Gravity.CENTER, 0, 0);
return popupWindow;
}
示例3: init
import android.widget.PopupWindow; //导入方法依赖的package包/类
private void init() {
setupColors();
setupList();
mSearchEditText.setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
mStartSearchImageView.setOnClickListener(this);
mDoneSearchImageView.setOnClickListener(this);
mSearchEditText.addTextChangedListener(mTextWatcher);
mPopupWindow = new PopupWindow(mContext);
mPopupWindow.setContentView(mSpinnerListContainer);
mPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
mPopupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
mPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
hideEdit();
}
});
mPopupWindow.setFocusable(false);
mPopupWindow.setElevation(DefaultElevation);
mPopupWindow.setBackgroundDrawable(ContextCompat.getDrawable(mContext, R.drawable.spinner_drawable));
mSpinnerListView.setOnItemClickListener(mOnItemSelectedListener);
if (mCurrSelectedView == null) {
if (!TextUtils.isEmpty(mSearchHintText)) {
mSearchEditText.setHint(mSearchHintText);
}
if (!TextUtils.isEmpty(mNoItemsFoundText)) {
mEmptyTextView.setText(mNoItemsFoundText);
}
if (mCurrSelectedView == null && !TextUtils.isEmpty(mRevealEmptyText)) {
TextView textView = new TextView(mContext);
textView.setText(mRevealEmptyText);
mCurrSelectedView = new SelectedView(textView, -1, 0);
mRevealItem.addView(textView);
}
} else {
mSpinnerListView.performItemClick(mCurrSelectedView.getView(), mCurrSelectedView.getPosition(), mCurrSelectedView.getId());
}
clearAnimation();
clearFocus();
}