社区首页 >问答首页 >当软键盘显示时,如何移动键盘上方的布局

当软键盘显示时,如何移动键盘上方的布局
EN

Stack Overflow用户
提问于 2015-08-09 07:11:20
回答 1查看 811关注 0票数 0

我的活动有一个简单的布局:

代码语言:javascript
代码运行次数:0
复制
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <EditText
        android:id="@+id/editTextName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/buttonCancel"
        android:layout_alignParentTop="true" />

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:text="cancel" />


</RelativeLayout>

当我触摸EditText,软键盘出现,但我的按钮隐藏在键盘之外!

但是我想把Button移到键盘上面。

我在AndroidManifest中添加了这一行代码,但是没有什么改变。

代码语言:javascript
代码运行次数:0
复制
<activity
    android:name=".Activity"
    android:windowSoftInputMode="adjustPan|adjustResize">
</activity>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-08-09 07:20:35

根据正式文件adjustPanadjustResize有相反的行为,因此我认为它们不应该一起使用。试一试,android:windowSoftInputMode="adjustResize",为我工作。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31905673

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档