gpt4 book ai didi

android - ScrollView 元素隐藏在 ActionBar 后面

转载 作者:行者123 更新时间:2023-11-29 18:03:17 25 4
gpt4 key购买 nike

当我点击一个文本字段并弹出键盘时,我的 ScrollView 上面的几个字段隐藏在 ActionBar 后面。

enter image description here

如果您查看滚动条,它位于最顶部。这意味着即使我现在向上滚动,元素也不会出现。

我正在使用 ActionBarSherlock。我不确定这是 ABS 还是 ScrollView 的问题。

这是我的 scrollView 的代码:

<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/scrollView_MessageUpdate"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MessengerActivity"
android:scrollbarStyle="outsideOverlay"
android:background="@drawable/repeating_bg"
>

<RelativeLayout
android:id="@+id/RelativeLayout_MessageUpdate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:gravity="center"
android:background="@drawable/repeating_bg"
>

<EditText
android:id="@+id/txtPostedBy"
android:hint="@string/txtPostedByHint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="12"
android:inputType="none"
android:layout_marginTop="100dip">

<requestFocus />
</EditText>

<EditText
android:id="@+id/txtPostTitle"
android:hint="@string/txtPostTitleHint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txtPostedBy"
android:ems="12"
android:layout_marginTop="3dip"
android:inputType="text">
</EditText>


<EditText android:id="@+id/txtMessage"
android:hint="@string/txtMessageHint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="3"
android:gravity="top|left"
android:inputType="textMultiLine"
android:scrollHorizontally="false"
android:layout_alignLeft="@+id/txtPostTitle"
android:layout_alignRight="@+id/txtPostTitle"
android:layout_below="@+id/txtPostTitle"
/>

<EditText android:id="@+id/txtComment"
android:hint="@string/txtCommentHint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="5"
android:gravity="top|left"
android:inputType="textMultiLine"
android:scrollHorizontally="false"
android:layout_alignLeft="@+id/txtPostTitle"
android:layout_alignRight="@+id/txtPostTitle"
android:layout_below="@+id/txtMessage"
/>

<Button
android:id="@+id/btnUpdateMessage"
android:text="@string/btnUpdateText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/txtComment"
style="@style/styledBuutonNoIcon_text"
android:background="@drawable/styled_inner_form_button"
android:layout_alignLeft="@+id/txtPostTitle"
android:layout_alignRight="@+id/txtPostTitle"
android:layout_marginTop="3dip" />

<Button
android:id="@+id/btnCancelMessage"
android:text="@string/btnCancelText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/btnUpdateMessage"
style="@style/styledBuutonNoIcon_text"
android:background="@drawable/styled_inner_form_button"
android:layout_alignLeft="@+id/txtPostTitle"
android:layout_alignRight="@+id/txtPostTitle"
android:layout_marginTop="3dip" />

<!--
<Button
android:text="@string/btnDeleteText"
android:id="@+id/btnDeleteSchool"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/btnCancelSchool"
style="@style/styledBuutonNoIcon_text"
android:background="@drawable/styled_inner_form_button"
android:layout_alignLeft="@+id/txtSchoolWebsite"
android:layout_alignRight="@+id/txtSchoolWebsite"
android:layout_marginTop="3dip"
/>
-->
</RelativeLayout>
</ScrollView>

最佳答案

AndroidManifest.xml 中的 android:windowSoftInputMode 设置为 "adjustPan"

根据 Documentation :

The activity's main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing.

关于android - ScrollView 元素隐藏在 ActionBar 后面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14694104/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com