Questions tagged «android-softkeyboard»

Android OS提供的默认屏幕输入法。



30
聚焦edittext时如何显示软键盘
我想在EditText焦点对准时自动显示软键盘(如果设备没有物理键盘),并且有两个问题: 当Activity显示my 时,我EditText处于聚焦状态,但未显示键盘,我需要再次单击它以显示键盘(在显示my时应显示它Activity)。 当我在键盘上单击“完成”时,将关闭键盘,但EditText保持焦点,并且您不想要(因为我的编辑已完成)。 要恢复,我的问题是在iPhone上有更多类似的东西:它使键盘与我的EditText状态保持同步(集中/不集中),并且如果有物理键盘,当然也不会显示软键盘。

6
Android:如何使键盘输入按钮说“搜索”并处理其点击?
我不知道这个。某些应用程序具有EditText(文本框),当您触摸它时,它会弹出屏幕键盘,该键盘具有“搜索”按钮,而不是Enter键。 我要实现这个。如何实现该搜索按钮并检测是否按下了搜索按钮? 编辑:找到如何实现搜索按钮;XML android:imeOptions="actionSearch"或Java中EditTextSample.setImeOptions(EditorInfo.IME_ACTION_SEARCH);。但是,如何处理用户按下“搜索”按钮?有关系android:imeActionId吗?

30
单击外部EditText后如何在android上隐藏软键盘?
好的,每个人都知道隐藏键盘需要实现: InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); 但是最重​​要的是,当用户触摸或选择其他非键盘位置时,如何隐藏键盘。 EditText或softKeyboard的? 我尝试使用 onTouchEvent()在父级上Activity但仅当用户触摸任何其他视图且没有滚动视图时,该方法才有效。 我尝试实现触摸,单击,焦点侦听器,但没有成功。 我什至尝试实现自己的滚动视图来拦截触摸事件,但是我只能获取事件的坐标,而不能单击视图。 有标准的方法吗?在iPhone中,这真的很容易。


11
为横向模式的软键盘输入禁用全屏编辑视图?
在使用软键盘的Android设备上,我想防止在横向模式下出现全屏键盘编辑视图(如下所示)(即,我只想看到软键盘本身及其后的视图)。 我假设可以使用上的setExtractViewShown(false)方法来实现InputMethodService,但是我无法访问此方法的默认实例,也不想实现自定义输入法。 编辑添加:输入将进入的视图不是一个视图TextView(View具有自定义InputConnection实现),因此android:imeOptions="flagNoExtractUi"在这里不起作用。


25
Android如何在可见软键盘时在全屏模式下调整布局
当软键盘处于活动状态时,我已经进行了很多研究来调整布局,并且我已经成功实现了它,但是当我android:theme="@android:style/Theme.NoTitleBar.Fullscreen"在清单文件中的活动标签中使用它时,问题就来了。 为此,我使用android:windowSoftInputMode="adjustPan|adjustResize|stateHidden"了其他选项,但没有运气。 之后,我以FullScreen编程方式实施并尝试使用各种布局,FullScreen但徒劳无功。 我引用了这些链接,并在此处查找了许多与此问题相关的帖子: http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html http://davidwparker.com/2011/08/30/android-how-to-float-a-row-above-keyboard/ 这是xml代码: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/masterContainerView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android" android:background="#ffffff"> <ScrollView android:id="@+id/parentScrollView" android:layout_width="fill_parent" android:layout_height="wrap_content"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <TextView android:id="@+id/setup_txt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Setup - Step 1 of 3" android:textColor="@color/top_header_txt_color" android:textSize="20dp" android:padding="8dp" android:gravity="center_horizontal" /> <TextView android:id="@+id/txt_header" android:layout_width="fill_parent" android:layout_height="40dp" android:text="AutoReply:" android:textColor="@color/top_header_txt_color" android:textSize="14dp" android:textStyle="bold" android:padding="10dp" android:layout_below="@+id/setup_txt" …

10
在NumberPicker上禁用软键盘
我试图在使用NumberPicker输入数字值(出于美观原因)时停用软键盘。这是我的layout-xml-code: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:id="@+id/linearLayout2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginBottom="30dp" android:layout_marginTop="30dp" > <NumberPicker android:id="@+id/repetitionPicker" android:layout_width="40dp" android:layout_height="wrap_content" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="@string/repetitions_short_divider" android:textAppearance="?android:attr/textAppearanceMedium" /> <NumberPicker android:id="@+id/weightPicker" android:layout_width="40dp" android:layout_height="wrap_content" android:layout_marginLeft="40dp" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="@string/pounds" android:textAppearance="?android:attr/textAppearanceMedium" /> </LinearLayout> <Button android:id="@+id/saveButton" android:layout_width="wrap_content" android:layout_height="wrap_content" …

15
软键盘出现时如何调整布局
我想在激活软键盘时调整/调整布局大小,如下所示: 之前和之后: 在SO中找到了几个资源: 显示软键盘时如何保持所有字段和文本可见 出现时android软键盘破坏布局 开启软键盘时调整布局 但是问题和答案都比较模棱两可,这是我想要的内容更清晰的问题。 要求: 它可以在任何屏幕尺寸的手机上使用。 注意,“ FACEBOOK”和“ Sign Up for Facebook”之前的边距/填充空间之前和之后都发生了变化。 不涉及滚动视图。

23
活动开始时如何隐藏软键盘
我android:windowSoftInputMode="stateVisible"在清单中有一个Edittext 。现在,当我开始活动时,将显示键盘。怎么藏起来?我无法使用,android:windowSoftInputMode="stateHidden因为当键盘可见时,请最小化应用程序并恢复它,键盘应可见。我尝试过 InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); 但它没有用。

11
Android屏幕键盘自动弹出
我的一个应用程序具有一个“正在打开的屏幕”(基本上是一个菜单),EditText其后跟着几个Buttons。问题是我的一些用户报告说,当他们打开应用程序时,它会自动弹出屏幕键盘,而他们甚至没有触摸EditText。据我所知,所有这些用户都在使用HTC Hero。 这是1.5版的错误吗?有什么我可以做的吗?

22
Android活动中的软键盘打开和关闭监听器
我有一个Activity5 EditText秒的地方。当用户单击第一个时EditText,软键盘将打开以在其中输入一些值。我想为软键盘打开的时间,用户第一次单击的时间以及从后退按钮上的软键盘关闭的其他时间设置其他View可见性。然后我要设定其他GoneEditTextEditTextView的可见性设置为visible。 通过单击EditTextAndroid中的第一个键盘来打开软键盘时,是否有任何侦听器或回调或任何破解程序?

5
android中adjustResize和adjustPan之间的区别?
我试图编写一个代码,该代码用于在软键盘出现时重新调整UI组件的大小。当我使用adjustResize时,它会调整UI组件的大小,同时AdjustPan给我相同的输出。我想知道它们之间的区别以及何时使用每个组件?哪一个(adjustPan或AdjustResize)适合调整UI大小? 这是我的xml: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" > <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:orientation="vertical" > <EditText android:id="@+id/editText5" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="45dp" android:ems="10" android:inputType="textPersonName" /> <Button android:id="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="40dp" android:text="My Button" /> </LinearLayout> </RelativeLayout> </ScrollView> 和清单文件: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.adjustscroll" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" …

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.