我试图实现这样的形象:

问题是当我在风景上并放置像图像的搜索栏时,软键盘覆盖所有屏幕,我想要的行为就像我试过的图像
android:windowSoftInputMode="adjustPan|adjustResize"
Run Code Online (Sandbox Code Playgroud)
并且似乎不起作用,至少在果冻豆上.有任何想法吗?谢谢
我正在尝试打开键盘,当我转移到第一个活动到第二个活动.主要活动中有两个按钮1)如果单击"NotShowKeyboard"按钮,它将打开带键盘的second.java活动2)如果点击了"ShowKeyboard"按钮,那么它将用键盘和EitdText打开second.java活动有焦点但问题是我不知道该怎么做.我把一些示例顶部显示键盘但在"ShowKeyboard"按钮上单击键盘打开并立即消失.
Main.java:
NotShowKeyboard.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
}
if (event.getAction() == MotionEvent.ACTION_UP) {
bundle.putBoolean("show", false);
Intent start = new Intent(Main.this, Start.class);
start.putExtras(bundle);
startActivity(start);
}
return false;
}
});
ShowKeyboard.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
}
if (event.getAction() == MotionEvent.ACTION_UP) {
bundle.putBoolean("show", true);
Intent start = new Intent(Main.this, Start.class);
start.putExtras(bundle);
startActivity(start);
}
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
Second.java:
@Override
protected void onCreate(Bundle savedInstanceState) …Run Code Online (Sandbox Code Playgroud) 我的代码是:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<EditText
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="@+id/editText"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="53dp"
android:layout_marginTop="34dp"
android:inputType="textNoSuggestions|text"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
JAVA Code I使用.
editText = (EditText) findViewById(R.id.editText);
editText.setInputType(InputType.TYPE_MASK_CLASS|InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
Run Code Online (Sandbox Code Playgroud)
我在EditText中使用android:inputType ="textNoSuggestions | text",它禁用了所有设备的预测文本,但在三星Tab 2中它不起作用.我也通过Android代码申请,但似乎它打开给三星标签2中禁用此预测文本框的任何其他建议.

其他设备预览它没有显示预测文本框.

三星Tab 2预览它显示预测文本框.
我有一个带有 onCreateInputView() 方法的键盘,我必须动态地编辑键盘,并且当特定首选项发生变化时我必须重新启动 onCreateInputView()
我想在软键盘打开时完成活动,我想覆盖软键盘的后退事件并完成活动。
我正在使用这个,但它不起作用,有什么想法吗?
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK &&
event.getAction() == KeyEvent.ACTION_UP) {
this.finish();
return false;
}
return super.dispatchKeyEvent(event);
}
Run Code Online (Sandbox Code Playgroud) 谁能给我android软键盘AOSP的源代码?我正在寻找一段时间但未找到:(
在默认的android键盘中有很多东西我在其他示例代码中找不到.
非常感谢你.
我的应用程序旨在收集数据。但它只需要在键盘可见时收集数据。仅在用户打字时收集数据是不够的,所以我肯定需要知道键盘是否可见。
我知道,类似的问题之前已经发布过(How to check Visibility of software Keyboard in Android?), 但最后一个获得大量赞成票的答案是从2012 年开始的,我想从那时起 Android 发生了很多事情。
那么,我可以检测键盘是否打开/可见吗?
我正在使用 InputMethodService、Keyboard 和 KeyboardView(我知道,它最近已被弃用)来创建自定义键盘。
override fun onCreateInputView(): View {
view = layoutInflater.inflate(
R.layout.keyboard_view_test,
null
)
keyboardView =
view.findViewById<KeyboardView>(R.id.keyboard)
keyboard = Keyboard(this, R.xml.keyboard_layout)
keyboardView.keyboard = keyboard
keyboardView.isPreviewEnabled = false
keyboardView.setOnKeyboardActionListener(this)
return keyboardView
}
Run Code Online (Sandbox Code Playgroud)
当使用 Keyboard_view_test.xml 中的 KeyboardView 作为根元素时,键盘工作得非常好。当我开始将它包装在 LinearLayout 或任何其他 ViewGroup 中而不更改任何其他内容时(请参阅keyboard_view_test.xml),我得到一个 IllegalStateException。我不明白,堆栈跟踪没有引用我的任何代码。我怎样才能让它发挥作用?
键盘视图测试.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorGboardBackground">
<android.inputmethodservice.KeyboardView
android:id="@+id/keyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorGboardBackground"
android:keyBackground="@drawable/key_background"
android:keyPreviewLayout="@layout/key_preview"
android:keyPreviewOffset="10dp"
android:keyTextColor="@color/colorGboardKeyText"
android:keyTextSize="22sp"
android:labelTextSize="22sp"
android:shadowRadius="0" />
Run Code Online (Sandbox Code Playgroud)
该错误似乎发生在 onCreateInputView() 返回后
错误堆栈:
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on …Run Code Online (Sandbox Code Playgroud) android android-softkeyboard android-input-method android-viewgroup
这是我在文件的卡片小部件中使用的表单的一部分auth_screen.dart:
child: Obx(() => Form(
key: _formKey,
child: SingleChildScrollView(
child: Column(
children: <Widget>[
TextFormField(
decoration: const InputDecoration(labelText: 'E-Mail'),
keyboardType: TextInputType.emailAddress,
validator: (value) {
if (value!.isEmpty || !value.contains('@')) {
return 'Invalid email!';
}
},
onSaved: (value) {
_authData['email'] = value as String;
},
),
TextFormField(
decoration: const InputDecoration(labelText: 'Password'),
obscureText: true,
controller: _passwordController,
validator: (value) {
if (value!.isEmpty || value.length < 5) {
return 'Password is too short!';
}
},
onSaved: (value) {
_authData['password'] = value as String;
}, …Run Code Online (Sandbox Code Playgroud) android-emulator android-softkeyboard flutter inputconnection
EditText尝试输入时,软键盘掩盖了我的字段EditText。
如何防止软键盘遮盖我的EditText领域?
按下返回按钮后,我可以看到我输入的内容,因为软键盘不再覆盖了EditText。
我正在使用银河10.1英寸平板电脑。
XML格式
<ScrollView
android:layout_width="wrap_content"
android:layout_height="400dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="1) Project"
android:textColor="#000000"
android:layout_gravity="bottom"
android:textSize="25sp" />
<EditText
android:id="@+id/projectET"
android:layout_width="500dp"
android:layout_height="wrap_content"
android:textSize="25sp"
android:ems="10"
android:hint="Project"
android:inputType="textCapWords"
android:layout_gravity="bottom"/>
<CheckBox
android:id="@+id/projectCBM"
android:layout_width="wrap_content"
android:layout_height="55dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="2) Customer"
android:textColor="#000000"
android:layout_gravity="bottom"
android:textSize="25sp" />
<EditText
android:id="@+id/customerET"
android:layout_width="500dp"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textCapWords"
android:layout_gravity="bottom"
android:textSize="25sp"
android:hint="Customer" />
<CheckBox
android:id="@+id/customerCBM"
android:layout_width="wrap_content"
android:layout_height="55dp" />
</LinearLayout> …Run Code Online (Sandbox Code Playgroud)