0

У меня возникла проблема, когда клавиатура скрывает текст редактирования, когда редактор editText выбран во второй раз, при первом выборе editText клавиатура ведет себя так, как ожидалось.Скрывает клавиатуру Редактирование текста, если выбрано

Проблема возникает, когда я устанавливаю тип ввода editText в «NumberDecimal», но когда он установлен на «Default», клавиатура также ведет себя нормально.

Я попытался следующие без успеха:

андроида: windowSoftInputMode = «adjustResize»

ниже отрывок из файла макета

<LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="30dp" 
       android:layout_marginTop="20dp" 
       android:gravity="center_vertical" 
       android:orientation="horizontal" 
       android:weightSum="1"> 

       <TextView 
        android:layout_width="0dp" 
        android:layout_height="fill_parent" 
        android:layout_gravity="center" 
        android:layout_marginLeft="10dp" 
        android:layout_weight="0.25" 
        android:background="@drawable/rounded_left_selected" 
        android:gravity="center" 
        android:text="@string/amount" 
        android:textColor="@color/white" 
        android:textSize="17dp" 

        android:textStyle="bold" /> 

       <EditText 
        android:id="@+id/transfer_amount" 
        android:layout_width="0dp" 
        android:layout_height="fill_parent" 
        android:layout_weight="0.55" 
        android:background="@drawable/white_unrounded_edittext" 
        android:ems="10" 
        android:gravity="center" 
        android:hint="@string/hint_amount" 
        android:maxLength="15" 
        android:textColor="@color/blue_light" 
        android:textSize="17dp" 
        android:inputType="numberDecimal"/> 

       <TextView 
        android:id="@+id/trans_amount_cur" 
        android:layout_width="0dp" 
        android:layout_height="match_parent" 
        android:layout_weight="0.12" 
        android:background="@drawable/round_right_selected" 
        android:gravity="center" 
        android:text="JOD" 
        android:textColor="@color/white" 
        android:textSize="17dp" /> 
      </LinearLayout> 

ответ

1

Просто удалите гравитацию на edittext, это кажется ошибкой.

<EditText 
       android:id="@+id/transfer_amount" 
       android:layout_width="0dp" 
       android:layout_height="fill_parent" 
       android:layout_weight="0.55" 
       android:background="@drawable/white_unrounded_edittext" 
       android:ems="10" 
       android:hint="@string/hint_amount" 
       android:maxLength="15" 
       android:textColor="@color/blue_light" 
       android:textSize="17dp" 
       android:inputType="numberDecimal"/> 
1

Вы можете добавить android: windowSoftInputMode = "adjustPan" в ваш манифест, в действие. Я думаю, что это лучший способ