1

テキストフィールドをタップしてキーボードがポップアップすると、ScrollViewの上部のいくつかのフィールドがActionBarの後ろに隠れます。

ここに画像の説明を入力してください

スクロールバーを見ると、それが一番上にあります。つまり、今上にスクロールしても、要素が表示されません。

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>
4

2 に答える 2

3

android:windowSoftInputModeにあなたの活動AndroidManifest.xmlのセット"adjustPan"

ドキュメントによると:

アクティビティのメインウィンドウは、ソフトキーボード用のスペースを確保するためにサイズ変更されていません。むしろ、ウィンドウの内容が自動的にパンされるため、現在のフォーカスがキーボードによって隠されることはなく、ユーザーは入力内容を常に確認できます。

于 2013-02-05T17:27:37.227 に答える
1

メインレイアウトの「中央」を削除して同じ問題を解決しました

android:layout_gravity="center"
android:gravity="center"
于 2015-02-02T14:54:44.227 に答える