Titanium view being pushed up when keyboard shows up

∥☆過路亽.° 提交于 2019-12-13 03:48:42

问题


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

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

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

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.


回答1:


have you tried using following in your manifest file

android:windowSoftInputMode="adjustPan"

like this

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

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



来源:https://stackoverflow.com/questions/23590078/titanium-view-being-pushed-up-when-keyboard-shows-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!