在运行时创建edittext时,edittext隐藏在键盘下 [英] Edittext hide under keyboard when edittext create on RunTime

查看:65
本文介绍了在运行时创建edittext时,edittext隐藏在键盘下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个将滚动视图作为根布局的布局,将一个线性布局作为具有垂直方向的子级.我在活动的onCreate线性布局中动态添加了一个编辑文本列表.问题是,当我专注于编辑文本时,布局不会在软键盘上向上滚动.但是,如果不动态添加编辑文本,则效果很好.我已经在清单中设置了调整平移.

I have a layout with scroll view as root layout with one linear layout as child with vertical orientation. I add a list of edit text dynamically in linear layout onCreate of activity. Problem is when i focus on an edit text the layout doesn't scroll up on soft keyboard up. But works perfectly if edit text are not added dynamically. I have already set adjust pan in manifest.

推荐答案

<activity
            android:name=".ActivityName"
            android:screenOrientation="nosensor"
            android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />

如果您只想将应用程序用于纵向模式,请使用nosensor.如果您不想每次活动打开时android都弹出该键盘,请使用stateAlwaysHidden.

Use nosensor if you want to use the app only for portrait modes. Use stateAlwaysHidden in the if you don't want android to pop that keyboard up everytime your activity opens.

查看此链接官方文档并进行检查其他stackoverflow 答案.

Check out this link the official documentation and check other stackoverflow answers.

这篇关于在运行时创建edittext时,edittext隐藏在键盘下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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