EditText - How to stop the keyboard from appearing when scrolled

CodeMonkeyCodeMonkey GBMember ✭✭✭

Hi all

Having an issue whereby when I scroll my EditText which is placed within a Scroller the keyboard is shown. I only need the keyboard to show when the EditText is explicitly clicked.

Here is the layout:

 <RelativeLayout
        android:id="@+id/mainContent"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@color/brandgreen"
        android:layout_below="@id/seperator2">
         <ScrollView
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/phraseScrollView"
     android:layout_width="match_parent"
     android:layout_height="match_parent"

     android:orientation="vertical" >
        <com.gravity.phraseme.android.CustomEditText
            android:layout_width="fill_parent"
            android:singleLine="false"
            android:gravity="top"
            android:padding="10dp"
            android:scrollbars="vertical"
            android:id="@+id/txtPhrase"
            android:maxLines="10"
            android:layout_alignParentTop="true"
            android:layout_gravity="top"
            android:layout_height="fill_parent"
            android:background="@color/brandgrey" />
            </ScrollView>
    </RelativeLayout>

I have tried the following:

  • Setting android:windowSoftInputMode="stateAlwaysHidden". I noticed this in the documentation though: > always hidden when the activity's main window has input focus.
    The EditText in question is part of a subview which is being added to my activities main view, which is actually a TabPage, would this effect the above config?

  • Set EditText.Focusable = false, but this had the effect of disabling all scrolling.

Any help appreciated!
Adrian

Sign In or Register to comment.