When the activity is launched, the user is prompted to enter in his email. A TextView
and Button
are visible along with keyboard. However, when the user taps on the button, it does not work - rather the keyboard disapears, then the user has to tap on the button again for it to work. Therefore, it takes two user taps to get this button to work. How can we get the button listener working while the keyboard is visible?
Here is what I have tried, in the manifest
I put this code:
android:windowSoftInputMode="adjustResize"
Here's my layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/provisioning_background_color">
<!-- https://stackoverflow.com/questions/15323758/android-how-to-push-button-above-soft-keyboard -->
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/btn_next_email">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/sign_in_logo_height"
android:src = "@drawable/bg_form_top"
android:layout_marginRight="@dimen/sign_in_logo_top_margin"/>
<Button
android:id="@+id/btn_already_have_account"
android:textAllCaps="false"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/borderlessButtonStyle"
android:textColor="@color/app_text_color"
android:textSize="17dp"
android:text="@string/already_have_account"/>
<EditText
android:id="@+id/text_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:textColor="@color/app_text_color"
android:gravity="center"
android:textColorHint="@color/app_text_color"
android:hint="Enter Email"
android:layout_marginTop="20dp"/>
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/btn_next_email"
android:layout_width="match_parent"
android:layout_height="@dimen/create_account_buttons"
android:textSize="@dimen/create_account_buttons_txt_size"
android:layout_alignParentBottom="true"
android:layout_margin="10dp"
android:text="NEXT"
style="@style/provisioning_buttons"
android:nextFocusForward="@+id/text_email"/>