显示软键盘时更改布局
我想在单击 EditText 并显示软键盘时更改布局,以便所有 EditText 视图仍然可见。
我知道您可以使用以下两个,但这不是我想要的。
android:windowSoftInputMode="stateUnchanged|adjustPan">
android:windowSoftInputMode="stateUnchanged|adjustResize">
我有 8 个 EditText 视图分布在整个屏幕上。当单击一个值来更改值时,我仍然希望看到所有 ET 视图,但要很好地排列,而不是推入一个奇怪的视图中。
有没有简单的方法可以做到这一点?
I would like to change the layout when an EditText is clicked and the softkeyboard is shown, so all EditText views are still visible.
I know that you can use the following two, but this is not what i'm looking for.
android:windowSoftInputMode="stateUnchanged|adjustPan">
android:windowSoftInputMode="stateUnchanged|adjustResize">
I've got 8 EditText views spread over the whole screen. When one is clicked to change a value I would like to still see all the ET views but nicely arrange and not pushed in a weird view.
Is there an easy way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您同时使用两者,则它不起作用。仅设置属性
android:windowSoftInputMode=" adjustmentPan"
。这应该有效。If you are using both at the same time then it doesnt work.Set the attribute
android:windowSoftInputMode="adjustPan"
only.That should work.我认为您必须自己执行此操作,但一种技术可能是...
创建一个布局,其中为显示的键盘排列的视图(例如新的relativelayout)覆盖您的标准布局。将其可见性设置为“消失”。然后,当您检测到显示键盘的事件时,隐藏当前视图并显示备用视图,
我想您也可以使用 ViewSwitcher
I think you are going to have to do this yourself, but one technique might be ...
Create a layout with the views arranged for the keyboard shown (for instance a new RelativeLayout) that overlays your standard layout. Set it's visibility to GONE. Then when you detect the event that shows the keyboard hide the current view and show the alternate one
I suppose you could also use a ViewSwitcher