Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:descendantFocusability="beforeDescendants"
- android:focusableInTouchMode="true"
- android:orientation="vertical">
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"/>
- <android.support.design.widget.TextInputLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/small"
- android:layout_marginEnd="@dimen/small"
- android:layout_marginStart="@dimen/small"
- android:layout_marginTop="@dimen/small">
- <android.support.design.widget.TextInputEditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:inputType="textPassword"/>
- </android.support.design.widget.TextInputLayout>
- <android.support.design.widget.TextInputLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/small"
- android:layout_marginEnd="@dimen/small"
- android:layout_marginStart="@dimen/small">
- <android.support.design.widget.TextInputEditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:inputType="textPassword"/>
- </android.support.design.widget.TextInputLayout>
- <android.support.design.widget.TextInputLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/small"
- android:layout_marginEnd="@dimen/small"
- android:layout_marginStart="@dimen/small">
- <android.support.design.widget.TextInputEditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:imeOptions="actionDone"
- android:inputType="textPassword" />
- </android.support.design.widget.TextInputLayout>
- <Button
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/small" />
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginEnd="@dimen/small"
- android:layout_marginStart="@dimen/small"
- android:layout_marginTop="@dimen/small" />
- <Button
- style="@style/Button.Small"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/small" />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
- <android.support.design.widget.TextInputLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/small"
- android:layout_marginEnd="@dimen/small"
- android:layout_marginStart="@dimen/small">
- <android.support.design.widget.TextInputEditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:imeOptions="actionDone"
- android:inputType="text" />
- </android.support.design.widget.TextInputLayout>
- <android.support.design.widget.TextInputLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/small"
- android:layout_marginEnd="@dimen/small"
- android:layout_marginStart="@dimen/small">
- <android.support.design.widget.TextInputEditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:imeOptions="actionDone"
- android:inputType="text" />
- </android.support.design.widget.TextInputLayout>
- </LinearLayout>
- </FrameLayout>
- </LinearLayout>
- /**
- * Clear the edit text focus if the touch is outside its limits
- *
- * @param context the activity context
- * @param editText the edit text
- * @param event the motion event
- */
- public static void clearEditTextFocusOnMontionEvent(@NonNull Context context, @NonNull EditText editText, @NonNull MotionEvent event) {
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
- Rect outRect = new Rect();
- editText.getGlobalVisibleRect(outRect);
- if (!outRect.contains((int) event.getRawX(), (int) event.getRawY())) {
- editText.clearFocus();
- hideKeyboard(context, editText);
- }
- }
- }
- if (actionId == EditorInfo.IME_ACTION_DONE) {
- WindowsHelper.hideKeyboard(context, view);
- view.clearFocus();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement