1

私はこれを前に見たことがありません。背景がアニメーション化されたシンプルなカスタムビューがあり、そのビューに加えて、標準のAndroidビューセットを実装しました。TextViews、EditTexts、ImageViewsなど...

ソフトキーボードが起動し、情報を入力しているときは、すべてが正常に機能します。キーボードが非表示になっていると、ビューがめちゃくちゃになります。これを見た人はいますか?これはGalaxyNexusSで発生しており、すべてのコードは標準実装です。設定や不足しているものはありますか?運が悪かったのでView.invalidateを試しました。この問題を修正する唯一の方法は、ビューをリロードすることです。これはかなり面倒です。

これが私が「登録」と呼ぶビューのコードです。

<?xml version="1.0" encoding="utf-8"?>

<!-- Intended for logging in or creating an account -->

<ImageView 
    android:id="@+id/fillininfo"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:scaleType="centerInside"
    android:background="@null"
    android:src="@drawable/friends_enroll_fillininfo"
/>

<ImageView 
    android:id="@+id/name"
    android:layout_below="@id/fillininfo"
    android:layout_width="wrap_content"
    android:layout_height="20dip"
    android:scaleType="centerInside"
    android:layout_centerHorizontal="true"
    android:background="@null"
    android:src="@drawable/name"
/>

<EditText
    android:id="@+id/friends_enroll_name"
    android:layout_marginLeft="5dip"
    android:layout_marginRight="5dip"
    android:layout_width="fill_parent"
    android:layout_height="30dip"
    android:layout_below="@id/name"
    android:hint="A name you go by..."
    android:inputType="textPersonName|textCapWords"
    android:gravity="center"
    android:textSize="16sp"
    android:maxLines="1"
    android:lines="1"
    android:singleLine="true"
    android:textColor="@color/white"
    android:textColorHighlight="@color/white"
    android:textColorHint="@color/white"
    android:textColorLink="@color/white"
    android:background="@drawable/textbox_background"

/>

<ImageView 
    android:id="@+id/email"
    android:layout_below="@id/friends_enroll_name"
    android:layout_width="wrap_content"
    android:layout_height="20dip"
    android:scaleType="centerInside"
    android:layout_centerHorizontal="true"
    android:background="@null"
    android:src="@drawable/email"
/>

<EditText
    android:id="@+id/friends_enroll_email"
    android:layout_marginLeft="5dip"
    android:layout_marginRight="5dip"
    android:layout_width="fill_parent"
    android:layout_height="30dip"
    android:layout_below="@id/email"
    android:hint="Your email address..."
    android:inputType="textEmailAddress"
    android:gravity="center"
    android:textSize="16sp"
    android:maxLines="1"
    android:lines="1"
    android:singleLine="true"
    android:textColor="@color/white"
    android:textColorHighlight="@color/white"
    android:textColorHint="@color/white"
    android:textColorLink="@color/white"
    android:background="@drawable/textbox_background"
/>

<RelativeLayout
    android:id="@+id/subscribed"
    android:layout_below="@id/friends_enroll_email"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_marginLeft="5dip"
    android:layout_marginRight="5dip"
    android:layout_marginTop="5dip"
    android:background="@null"
>
    <TextView
        android:id="@+id/subscribed_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="16sp"
        android:background="@null"
        android:layout_centerVertical="true"
        android:text="Email updates and product offers"
    />

    <CheckBox
        android:id="@+id/friends_enroll_issubscribed"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dip"
        android:layout_toRightOf="@id/subscribed_text"
        android:checked="true"
        android:text=" "
    />

</RelativeLayout>

<ImageButton 
    android:id="@+id/send_confirmation"
    android:layout_width="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_height="40dip"
    android:layout_below="@id/subscribed"
    android:scaleType="centerInside"
    android:src="@drawable/button_send_confirmation"
    android:background="@null"
/>

<TextView 
    android:id="@+id/friends_enroll_msg"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/send_confirmation"
    android:textColor="@color/white"
    android:text=""
    android:singleLine="false"
    android:gravity="center"
    android:textSize="14sp"
/>

ソフトキーボードを最小化した後にビューが歪む-android

よろしく、

ボブ

4

1 に答える 1

0

レイアウトのXMLでandroid:imeOptionsを「actionDone」に設定することでこれに答えました。

ソフトキーボードは「actionNext」を想定していたため、ビューが上にシフトしてビューが歪んでしまいました。「actionDone」を指定すると、ビューは別のEditTextを想定しなくなります。

于 2012-01-25T17:51:54.117 に答える