0

Есть Navigation Drawer Activity, есть фрагмент, который запускается с него. Есть поле ввода (editText) и кнопки под ним. Как сделать, чтобы при нажатии на editText, кнопки появлялись над клавиатурой, а не клавиатура закрывала их видимость? Советовали в манифесте для активити просписать такое android:windowSoftInputMode="adjustPan" пробовал но не оказывает никакого влияния.

xml фрагмента

Корневой layout LinearLayout почему-то не показывается в сообщении, с параметрами android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical".

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <******.*********.rest.DynamicImageView
        android:id="@+id/ivWord"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_marginRight="0.5dp"
        android:layout_weight="1"
        android:gravity="center"
        android:scaleType="centerCrop"
        android:src="@drawable/emty_picture" />

    <TextView
        android:id="@+id/tvWord"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center_horizontal"
        android:layout_marginLeft="0.5dp"
        android:layout_weight="0.5"
        android:background="@color/colorPrimary"
        android:gravity="center"
        android:text="word"
        android:textColor="@color/colorYellow"
        android:textSize="35sp"
        android:textStyle="bold" />
</LinearLayout>

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="1dp"
    android:layout_weight="0.4">

    <EditText
        android:id="@+id/etEnterWord"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/colorGrey"
        android:gravity="center_horizontal"
        android:hint="@string/etHintEnterWord"
        android:inputType="textNoSuggestions"
        android:maxLength="15"
        android:minLines="1"
        android:textSize="35sp"
        android:textStyle="bold" />

    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|bottom"
        android:layout_marginTop="1dp"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_ad_unit_id">
    </com.google.android.gms.ads.AdView>

</FrameLayout>


<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="1dp"
    android:layout_weight="1"
    android:orientation="horizontal">

    <Button
        android:id="@+id/btnHelp"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginRight="0.5dp"
        android:layout_weight="1"
        android:background="@color/colorYellow"
        android:gravity="center"
        android:text="@string/btnHelp"
        android:textColor="@color/colorPrimary"
        android:textSize="30dp" />

    <Button
        android:id="@+id/btnCheck"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="0.5dp"
        android:layout_weight="0.2"
        android:background="@color/colorYellow"
        android:gravity="center"
        android:text="@string/btnCheck"
        android:textColor="@color/colorPrimary"
        android:textSize="30dp" />
</LinearLayout>

Пример того, чего хочу добиться на скриншоте программы duolingvo.

введите сюда описание изображения

4
  • А это пробовали: android:windowSoftInputMode="adjustResize"?
    – ЮрийСПб
    26 окт 2015 в 22:39
  • Да пробовал, это все советуют. 26 окт 2015 в 22:41
  • Есть подозрение, что трабла в разметке xml. 26 окт 2015 в 22:43
  • Ну, приведите тогда и разметку в вопросе - может вам кто с утра и поможет) У меня идей больше нет, а все остальные спят)
    – ЮрийСПб
    26 окт 2015 в 22:44

2 ответа 2

3

все оказалось просто, помимо записи в манифесте android:windowSoftInputMode="adjustPan" нужно еще было в последнем LinearLayout убрать вес и по высоте поставить wrap_content и получаем вот такую красоту))))

введите сюда описание изображения

0

Посмотри кажется есть готовая библиотека под названием SizeAdjustingTextView

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.