当键盘出现时,钛视图被向上推 [英] Titanium view being pushed up when keyboard shows up

查看:36
本文介绍了当键盘出现时,钛视图被向上推的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个如下所示的窗口(垂直布局):

I have a window (vertical layout) that looks like this:

-Window
   -View1
   -View2
   -ScrollView1
   -ScrollView2
       -TextArea (contained in the scrollView2)

当我专注于 textarea 时,键盘会出现,但是当发生这种情况时,View1 和 View2 向上滚动并移出窗口.所以现在看起来像这样:

When I focus in on the textarea the keyboard comes up, but when this happens View1 and View2 scroll up and out of the window. So it looks like this now:

-Window
   -ScrollView1
   -ScrollView2
      -Textarea
   -Keyboard

我需要这两个视图保持原状,并且只有 scrollView1 和 scrollView2 中的内容( scrollView2 因为它包含 textarea ,如果它不在 scrollView 中,则键盘与 textarea 重叠,因此用户看不到他们正在输入的内容).如何阻止View1和View2被向上推?我想如果我让 View1 和 View2 的 top 属性为 0,它们将始终保持原状.

I need these two views to stay put and only have the content inside scrollView1 and scrollView2 ( scrollView2 because it contains the textarea and if it is not in a scrollView the keyboard overlaps the textarea so users can't see what they are typing ). How to stop View1 and View2 from being pushed up? I thought if I made View1 and View2 with a top property of 0 that they would always stay put.

推荐答案

您是否尝试过在清单文件中使用以下内容

have you tried using following in your manifest file

android:windowSoftInputMode="adjustPan"

喜欢这个

<activity
    android:name="com.example.activity.YourActivity"
    android:label="@string/title_activity_subscription_setup"
    android:screenOrientation="portrait"
    android:windowSoftInputMode="adjustPan" >
</activity>

有多种值,例如 adjustPan、adjustResize 等.尝试一下,看看哪种最适合您的情况.

there are various values like adjustPan, adjustResize etc etc. Try them out to see what works best for your situation.

这篇关于当键盘出现时,钛视图被向上推的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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