2016-05-19 3 views
0

В приложениях Android По умолчанию при нажатии или фокусировке на edittext открывается системная клавиатура. Но в моем приложении клавиатура не показывает. Зачем ?Android Edittext не открывает клавиатуру?

Код Компоновка:

<?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> 

некоторая часть AndroidManifest.xml

Dont попытка сказать, что вы использовали андроида: windowSoftInputMode = "stateHidden". Я использовал его, потому что он скрывает клавиатуру при запуске активности.

<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> 
+0

Добавить этот 'android: focusable =" true " android: focusableInTouchMode =" true "' в ваш 'Редактировать текст'. –

+0

Вы используете эмулятор, потому что в эмуляторе клавиатура не открывается? –

+0

@ KastriotDreshaj открыто. Не волнуйся. – hkaraoglu

ответ

0

Ok. Я решил свою проблему. Я удаляю android: textIsSelectable = "true" от edittexts. Он работает

Смежные вопросы