Question

I have never seen this before. I have a simple custom view that has an animated background, and on top of that view I've implemented the standard Android viewset. TextViews, EditTexts, ImageViews, etc...

When the soft keyboard is up and I am entering information everything works normally. When the keyboard is hidden, the views get messed up. Anyone seen this before? It is occurring on a Galaxy Nexus S, and all the code is standard implementation. Any settings or something I am missing? I have tried View.invalidate with no luck. The only way to fix the issue is to reload the view -which I find rather annoying!

Here is the code for the View I call, "Enroll".

<?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"
/>

Views distorted after soft keyboard is minimized - android

Regards,

Bob

Was it helpful?

Solution

I answered this by setting the android:imeOptions in my layout's XML to "actionDone".

The soft-keyboard was assuming "actionNext" causing the view to shift upwards distorting the view. With the "actionDone" specified the view no longer assumes another EditText.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top