⑴ 如何实现监听android输入法弹出收回,为什么
在输入法弹出的时候,后面的内容不会缩放;而评论输入框刚好显示在输入法面板上(above)。
这里不仅需要监听到输入法的弹出和关闭,还要获取到输入法的高度。
如果发现输入法没有弹出了,那么onMeasure就直接用传进来的参数调用。
如果发现输入法弹出了,那么更改参数,保证View没有缩小。
⑵ android输入法是怎样调用的
Android软键盘强制弹出及隐藏输入法的方法:
很多应用中对于一个界面比如进入搜索界面或者修改信息等等情况,为了用户体验应该自动弹出软键盘而不是让用户主动点击输入框才弹出(因为用户进入该界面必然是为了更改信息)。具体实现这种效果的代码如下:
java代码
EditText editText.setFocusable(true);
editText.setFocusableInTouchMode(true);
editText.requestFocus();
InputMethodManager inputManager =
(InputMethodManager)editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.showSoftInput(editText, 0);
首先要对指定的输入框请求焦点。然后调用输入管理器弹出软键盘。
警告:对于刚跳到一个新的界面就要弹出软键盘的情况上述代码可能由于界面为加载完全而无法弹出软键盘。此时应该适当的延迟弹出软键盘如998毫秒(保证界面的数据加载完成)。实例代码如下:
java代码:
Timer timer = new Timer();
timer.schele(new TimerTask()
{
public void run()
{
InputMethodManager inputManager =
(InputMethodManager)editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.showSoftInput(editText, 0);
}
},
998);
⑶ android怎么获取屏幕高度,除去输入法键盘占用的那些
用InputViewManager.getCurrentView当前view,然后调用view中的void getBoundsOnScreen(Rect outRect)获得大小
用这个方法试试
⑷ android 中如何获取系统中安装的所有输入法并以列表显示
private void onCreateIMM() {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mInputMethodProperties = imm.getInputMethodList();
mLastInputMethodId = Settings.Secure.getString(getContentResolver(),
Settings.Secure.DEFAULT_INPUT_METHOD);
PreferenceGroup textCategory = (PreferenceGroup) findPreference("text_category");
int N = (mInputMethodProperties == null ? 0 : mInputMethodProperties
.size());
for (int i = 0; i < N; ++i) {
InputMethodInfo property = mInputMethodProperties.get(i);
String prefKey = property.getId();
CharSequence label = property.loadLabel(getPackageManager());
boolean systemIME = isSystemIme(property);
// Add a check box.
// Don't show the toggle if it's the only keyboard in the system, or it's a system IME.
if (mHaveHardKeyboard || (N > 1 && !systemIME)) {
CheckBoxPreference chkbxPref = new CheckBoxPreference(this);
chkbxPref.setKey(prefKey);
chkbxPref.setTitle(label);
textCategory.addPreference(chkbxPref);
mCheckboxes.add(chkbxPref);
}
// If setting activity is available, add a setting screen entry.
if (null != property.getSettingsActivity()) {
PreferenceScreen prefScreen = new PreferenceScreen(this, null);
String settingsActivity = property.getSettingsActivity();
if (settingsActivity.lastIndexOf("/") < 0) {
settingsActivity = property.getPackageName() + "/" + settingsActivity;
}
prefScreen.setKey(settingsActivity);
prefScreen.setTitle(label);
if (N == 1) {
prefScreen.setSummary(getString(R.string.onscreen_keyboard_settings_summary));
} else {
CharSequence settingsLabel = getResources().getString(
R.string.input_methods_settings_label_format, label);
prefScreen.setSummary(settingsLabel);
}
textCategory.addPreference(prefScreen);
}
}
}
⑸ android 怎么获得输入法整个布局的尺寸和坐标呢
获得屏幕尺寸的话是:
DisplayMetrics dm = new DisplayMetrics();
//获取窗口属性
getWindowManager().getDefaultDisplay().getMetrics(dm);
int screenWidth = dm.widthPixels;
int screenHeight = dm.heightPixels;
⑹ android 点击EditText后,设置弹出的输入法高度
你可以 参考一下 InputMethodService这个类的接口。 大部分对输入法的操作都可以通过它来完成。
⑺ android如何获取输入法高度,急!!!
什么叫输入法高度,是大小吧。。。
⑻ 如何获取搜狗输入法键盘高度
搜狗输入法键盘高度设置如下:
1、首先要把搜狗输入法升级到最新版本才可以自定义键盘的高度的
2、在输入法界面,点设置图标,如下图
⑼ android 有没有获取系统软键盘的高度的方法
没有直接获得的方法,貌似有种从根layout高度来减的方法间接获得,不过我没试过。
⑽ Android 如何实现在隐藏键盘后,让输入框保持当前高度,类似QQ、微信聊天窗口。
当editText获取焦点的时候,需要直接调用显示键盘命令:<pre t="code" l="java">editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
}
});