Android:如何按下软键盘上方的按钮 [英] Android: How to push button above soft keyboard

查看:38
本文介绍了Android:如何按下软键盘上方的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个保存"按钮,我想将它与软键盘一起向上推.因此,当用户在我的布局中单击 EditText 时,按钮必须保持在键盘上方.现在按钮隐藏在键盘下方.你是怎么做到的?

I've got a "save" button which I want to push up together with the soft keyboard. So when the user clicks an EditText in my layout, then the button has to stay above the keyboard. Now the button becomes hidden underneath the keyboard. How do you do this?

提前致谢!

推荐答案

您需要将键盘的输入模式设置为 adjustResize.您可以在清单中的活动属性中添加以下行来执行此操作:

You need to set your keyboard's input mode to adjustResize. You can do this adding the following line to your activity's attributes in the manifest:

    android:windowSoftInputMode="adjustResize"

这是在活动中添加的属性的示例:

Here's an example of the attribute added in the activity:

<activity 
     android:name=".activity.MyActivity"
     android:windowSoftInputMode="adjustResize">
</activity>

这篇关于Android:如何按下软键盘上方的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆