如何保持所有领域,同时显示软键盘案文可见 [英] How to keep all fields and texts visible while the soft keyboard is shown

查看:258
本文介绍了如何保持所有领域,同时显示软键盘案文可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这个登录界面的工作,我想各个领域,文本和按钮显示在IME时调整。我已经使用了android:windowSoftInputMode =adjustResize在AndroidManifest.xml中,但我仍然得到一些其他的元素下

I'm working in this login screen, and I want all fields, texts and buttons to resize when the IME is shown. I've already used the android:windowSoftInputMode="adjustResize" on androidManifest.xml, but i'm still getting some elements underneath others.

我也不会,如果TextView的地籍阿戈拉(ID = cadastrar)保持由虚拟键盘覆盖重要。但是,只要有几个要素,我试图使至少EditTexts(及其TextViews)和按钮可见。

I wouldn't matter if the TextView "Cadastre Agora" (id= cadastrar) remains covered by the virtual keyboard. But, as long as there are few elements, i'm trying to make at least the EditTexts (and their TextViews) and the button visible.

我发现这个没有答案的问题,可能是一个有趣的方法:HTTP://stackoverflow.com/问题/ 6484024 /软键盘保持一视后的固定而移动的,其他

I found this unanswered question that could be an interesting approach: http: //stackoverflow.com/ questions/6484024/soft-keyboard-keep-one-view-stationary-while-moving-other

感谢您的帮助!

无IME屏幕: http://imageshack.us/photo/my -images / 138 / semttulo2mr.png /

屏幕采用IME(TextView1被隐藏起来):的http:// imageshack。美国/照片/我的图像/ 404 / semttulo3xw.png /

Screen with IME (TextView1 becomes hidden): http://imageshack.us/photo/my-images/404/semttulo3xw.png/

#1抱怨我的code格式,所以我在这里上传xml文件:HTTPS://rapidshare.com /files/1767398103/login.xml
我不能发布超过2个链接,这就是为什么我把空格在其中。

Stackoverflow is complaining about my code formatting, so i uploaded the xml file here: https ://rapidshare.com /files/1767398103/login.xml And i can't post more than 2 links, thats why I put spaces in them.

推荐答案

在这种情况下,我会说你的初始布局(无键盘的表现)已经是有问题的。考虑到你所创造的东西似乎纯粹是一个登录界面,将是可以接受的所有控件放置在屏幕的上半部分,当用户访问该页面自动拥有键盘显示。这使得经验,为用户更快,可以节省您不必拿出一个灵活的布局。

In this case I would say your initial layout (without the keyboard showing) is already problematic. Given you are creating what appears to purely be a login screen it would be acceptable to place all your controls in the top half of the screen and have the keyboard display automatically when the user visits the page. This makes the experience faster for the user and saves you having to come up with a flexible layout.

但是,如果你想尝试,使布局工作,这两种观点,您需要更改间距是控制之间的动态。

But if you want to try and make the layout work in both views, you will need to change the spacing to be dynamic between the controls.

例如:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width = "fill_parent"
    android:layout_height = "fill_parent"
    android:orientation="vertical"
    >
    <Space 
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:layout_weight="1">
        <!-- Username Controls here -->
    <Space 
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:layout_weight="1">
        <!-- Password Controls here -->
    <Space 
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:layout_weight="1">
        <!-- Login Button here -->
    <Space 
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:layout_weight="1">
        <!-- TextView here -->
    <Space 
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:layout_weight="1">
</LinearLayout>

有关这个正常工作,所有的垂直填补必须从你的控件中取出,用标签的文本框之间填充的除外。

For this to work properly, all of the vertical padding must be removed from your controls, with the exception of padding between the labels for the textboxes.

这篇关于如何保持所有领域,同时显示软键盘案文可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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