I have a scrollview in my fragment and when the fragment opens the keyboard appears automatically and focuses on the first edittext of the layout, and the screen scroll and I cannot see all the fields while the keyboard is opend. So what can I do to prevent the Keyboard from appearing when the fragment starts and also what can I do to see all the fields in the scrollview with the keyboard opened?
Thanks
That's part of the XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/personalDataLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context=".presentation.fragments.PersonalDataFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
The highest level View that is focusable will be focused. EditTexts pull up the keyboard if it is focused. But if you add the following to your parent View (RelativeLayout, LinearLayout, etc) then the keyboard will not automatically be opened
android:focusable="true"
android:focusableInTouchMode="true"
Example:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_height="match_parent">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.