本文整理汇总了Java中android.widget.PopupWindow.setSoftInputMode方法的典型用法代码示例。如果您正苦于以下问题:Java PopupWindow.setSoftInputMode方法的具体用法?Java PopupWindow.setSoftInputMode怎么用?Java PopupWindow.setSoftInputMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.PopupWindow
的用法示例。
在下文中一共展示了PopupWindow.setSoftInputMode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
* 添加一些属性设置
* @param popupWindow
*/
private void apply(PopupWindow popupWindow){
popupWindow.setClippingEnabled(mClippEnable);
if(mIgnoreCheekPress){
popupWindow.setIgnoreCheekPress();
}
if(mInputMode!=-1){
popupWindow.setInputMethodMode(mInputMode);
}
if(mSoftInputMode!=-1){
popupWindow.setSoftInputMode(mSoftInputMode);
}
if(mOnDismissListener!=null){
popupWindow.setOnDismissListener(mOnDismissListener);
}
if(mOnTouchListener!=null){
popupWindow.setTouchInterceptor(mOnTouchListener);
}
popupWindow.setTouchable(mTouchable);
}
示例2: apply
import android.widget.PopupWindow; //导入方法依赖的package包/类
private void apply(PopupWindow mPopupWindow) {
mPopupWindow.setClippingEnabled(this.mClippEnable);
if(this.mIgnoreCheekPress) {
mPopupWindow.setIgnoreCheekPress();
}
if(this.mInputMode != -1) {
mPopupWindow.setInputMethodMode(this.mInputMode);
}
if(this.mSoftInputMode != -1) {
mPopupWindow.setSoftInputMode(this.mSoftInputMode);
}
if(this.mOnDismissListener != null) {
mPopupWindow.setOnDismissListener(this.mOnDismissListener);
}
if(this.mOnTouchListener != null) {
mPopupWindow.setTouchInterceptor(this.mOnTouchListener);
}
mPopupWindow.setTouchable(this.mTouchable);
}
示例3: onClick
import android.widget.PopupWindow; //导入方法依赖的package包/类
@Override
public void onClick(final View widget) {
View view = LayoutInflater.from(context).inflate(R.layout.layout_input, null);
final EditText etInput = (EditText) view.findViewById(R.id.et_answer);
Button btnFillBlank = (Button) view.findViewById(R.id.btn_fill_blank);
// 显示原有答案
String oldAnswer = answerList.get(position);
if (!TextUtils.isEmpty(oldAnswer)) {
etInput.setText(oldAnswer);
etInput.setSelection(oldAnswer.length());
}
final PopupWindow popupWindow = new PopupWindow(view, LayoutParams.MATCH_PARENT, dp2px(40));
// 获取焦点
popupWindow.setFocusable(true);
// 为了防止弹出菜单获取焦点之后,点击Activity的其他组件没有响应
popupWindow.setBackgroundDrawable(new PaintDrawable());
// 设置PopupWindow在软键盘的上方
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
// 弹出PopupWindow
popupWindow.showAtLocation(tvContent, Gravity.BOTTOM, 0, 0);
btnFillBlank.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// 填写答案
String answer = etInput.getText().toString();
fillAnswer(answer, position);
popupWindow.dismiss();
}
});
// 显示软键盘
InputMethodManager inputMethodManager =
(InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
}
示例4: initView
import android.widget.PopupWindow; //导入方法依赖的package包/类
/**
* 密码键盘默认样式
* @param context
*/
private void initView(Context context) {
mkeyboardLayout = new LinearLayout(context);
mkeyboardLayout.setOrientation(LinearLayout.VERTICAL);
if (null != mKeyBoardBgDrawable) {
mkeyboardLayout.setBackgroundDrawable(mKeyBoardBgDrawable);
} else {
mkeyboardLayout.setBackgroundColor(Color.GRAY);
}
LinearLayout.LayoutParams titleParams = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
titleParams.setMargins(0, 0, 0, 6);
mTitleLayout = new LinearLayout(context);
mTitleLayout.setGravity(Gravity.CENTER);
mTitleLayout.setOrientation(LinearLayout.HORIZONTAL);
mTitleLayout.setLayoutParams(titleParams);
int titleBackgroundColor = mContext.getResources()
.getColor(R.color.bg_security_keyboard_title);
mTitleLayout.setBackgroundColor(titleBackgroundColor);
mTitleView = new TextView(context);
mTitleView.setText("Secure Mode");
mTitleView.setTextColor(Color.WHITE);
mTitleView.setHeight(getSaftyKeyHeight() / 16);
mTitleView.setGravity(Gravity.CENTER);
mTitleLayout.addView(mTitleView);
mKeyBoardControl = new GrapeGridview(context);
mKeyBoardControl.setHorizontalScrollBarEnabled(false);
mKeyBoardControl.setVerticalScrollBarEnabled(false);
mKeyBoardControl.setEnabled(false);
mKeyBoardControl.setNumColumns(Constant.COLUMN_SOFT_KEYBOARD);
mKeyBoardControl.setVerticalSpacing(mMarginRow);
mKeyBoardControl.setHorizontalSpacing(mMarginCol);
mKeyBoardControl.setAdapter(mAdapter);
mkeyboardLayout.addView(mTitleLayout);
mkeyboardLayout.addView(mKeyBoardControl);
mkeyboardLayout.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight,
mPaddingBottom);
mPopup = new PopupWindow(mkeyboardLayout, mWidth, mHeight);
mPopup.setBackgroundDrawable(new BitmapDrawable());
mPopup.setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
mPopup.setOutsideTouchable(true);
mPopup.setFocusable(true);
mPopup.setOnDismissListener(dismissListener);
}
示例5: 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();
}