In Android applications , Defaultly , when click or focus on edittext , the system keyboard opens. But in my app, keyboard doesnt show. Why ?
Layout code :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:clickable="true"
android:paddingLeft="@dimen/login_padding"
android:paddingRight="@dimen/login_padding"
android:paddingTop="@dimen/login_padding">
<!--<android.support.design.widget.TextInputLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:background="#fff"-->
<!--android:padding="4dp">-->
<!--</android.support.design.widget.TextInputLayout>-->
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/scrollView2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/header_logo"
android:scaleType="fitStart" />
<EditText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/email"
android:nextFocusDown="@+id/password"
android:textIsSelectable="true"
android:inputType="textEmailAddress"/>
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:ems="10"
android:hint="@string/password"
android:inputType="textPassword"
android:textIsSelectable="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/register"
android:background="@drawable/buttontype1"
android:textColor="@color/loginScreenButtonTextColor"
android:layout_weight="0.4"
android:layout_marginRight="30dp" />
<Button
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/login"
android:background="@drawable/buttontype1"
android:textColor="@color/loginScreenButtonTextColor"
android:layout_weight="0.4" />
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/forgot_my_password"
android:id="@+id/forgot_password"
android:background="@null"
android:gravity="left"
android:layout_marginTop="20dp" />
<TextView
android:id="@+id/information"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>
some part of AndroidManifest.xml
Dont attempt to say you used android:windowSoftInputMode="stateHidden" . I used it because it hides keyboard on activity start.
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/MyLibrary">
<activity android:name=".main.SplashActivity" android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".login.LoginActivity"
android:label="@string/title_activity_login"
android:windowSoftInputMode="stateHidden"
android:theme="@style/MyLibrary" />
<activity
android:name=".login.RegisterActivity"
android:label="@string/title_activity_forgot_password" />
<activity android:name=".login.ForgotPasswordActivity" />
<activity android:name=".home.HomeActivity" ></activity>
</application>