Подьем кнопок над клавиатурой?

В моём приложении есть две активности, где есть поле для ввода текста, а под ним три кнопки. Так вот у меня проблема - при нажатии на текстедит всплывает клавиатура и закрывает кнопки, а мне нужно, чтобы кнопки были над клавиатурой. Просьба помочь с решением проблемы?
P.S. хотел вставить скрины (пишу с телефона), но такой возможности тут нет, поэтому ссылка на приложение. Окна в которых проблема "Учим слова" и "Повторяем слова" https://play.google.com/store/apps/details?id=fomi...

Вот xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:id="@+id/fragment_learn_words"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginRight="2dp"
        android:layout_marginLeft="2dp"
        android:layout_marginTop="2dp"
        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/empty_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/color_inter_color_background"
            android:gravity="center"
            android:text="@string/emptyWord"
            android:textColor="@color/color_inter_color_font"
            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:layout_marginRight="2dp"
            android:layout_marginLeft="2dp"
            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_marginRight="2dp"
        android:layout_marginLeft="2dp"
        android:layout_margin="2dp"
        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/color_inter_color_background_button"
            android:gravity="center"
            android:text="@string/btnHelp"
            android:textColor="@color/color_inter_color_font_button"
            android:textSize="30dp" />

        <Button
            android:id="@+id/btnCheck"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginRight="0.5dp"
            android:layout_weight="0.4"
            android:background="@color/color_inter_color_background_button"
            android:gravity="center"
            android:text="@string/btnCheck"
            android:textColor="@color/color_inter_color_font_button"
            android:textSize="30dp" />

        <Button
            android:id="@+id/btnNextWord"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@color/color_inter_color_background_button"
            android:gravity="center"
            android:text="@string/btnNextWord"
            android:textColor="@color/color_inter_color_font_button"
            android:textSize="30dp" />
    </LinearLayout>
</LinearLayout>
  • Вопрос задан
  • 10257 просмотров
Решения вопроса 1
@razer89
Android-разработчик
Установите в AndroidManifest вашей активити флаг windowSoftInputMode="adjustResize" и посмотрите результат. Думаю, должно помочь.
<activity android:name=".MainActivity"
            android:windowSoftInputMode="adjustResize">

Скомпилил ваш xml у себя, слегка его модифицировав:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:id="@+id/fragment_learn_words"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="96dp"
        android:layout_marginRight="2dp"
        android:layout_marginLeft="2dp"
        android:layout_marginTop="2dp"
        android:orientation="horizontal">

        <ImageView
        android:id="@+id/ivWord"
        android:layout_width="96dp"
        android:layout_height="match_parent"
        android:layout_gravity="center_vertical"
        android:layout_marginRight="0.5dp"
        android:gravity="center"
            android:src="@android:drawable/ic_dialog_dialer"
        android:scaleType="centerCrop" />

        <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:background="?attr/colorPrimary"
            android:gravity="center"
            android:text="empty"
            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:layout_marginRight="2dp"
            android:layout_marginLeft="2dp"
            android:background="@android:color/darker_gray"
            android:gravity="center_horizontal"
            android:hint="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="123456">
        </com.google.android.gms.ads.AdView>
    </FrameLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginRight="2dp"
        android:layout_marginLeft="2dp"
        android:layout_margin="2dp"
        android:layout_marginTop="1dp"
        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="?attr/colorPrimary"
            android:gravity="center"
            android:text="\?"
            android:textSize="30dp" />

        <Button
            android:id="@+id/btnCheck"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginRight="0.5dp"
            android:layout_weight="0.4"
            android:background="?attr/colorPrimary"
            android:gravity="center"
            android:text="Проверить"
            android:textSize="30dp" />

        <Button
            android:id="@+id/btnNextWord"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="?attr/colorPrimary"
            android:gravity="center"
            android:text="->"
            android:textSize="30dp" />
    </LinearLayout>
</LinearLayout>

Вот что получилось:
26b278c1c09f45f6919960c0e9e67718.png2491a255a962443887cb44655254eb71.png
Такого результата вы ожидаете?
Ответ написан
Пригласить эксперта
Ответы на вопрос 2
Оберните вашу верстку в ScrollView. И клавиатура не будет закрывать кнопки.
Ответ написан
Комментировать
mfomichov
@mfomichov Автор вопроса
Благодаря razer89 мой вопрос решен ну и фотоподтверждениеce65165124e94cf385306dac4ffcbfb0.jpg
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы