Android макет сжимается, если клавиатура видна - PullRequest
0 голосов
/ 25 мая 2020

Я разрабатываю макет Android с помощью Xamarin. Когда клавиатура видна, раскладка сжата.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:weightSum="20"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="3dp"
        android:background="@drawable/faded_div"/>

    <LinearLayout
        android:id="@+id/div1"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="2"
        android:gravity="center_vertical"/>

    <ScrollView
        android:id="@+id/scroll"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="16"
        android:orientation="vertical"/>

    <RelativeLayout
        android:id="@+id/div2"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="2">

        <Common.Droid.UI.Controls.NXButton
            android:layout_height="44dp"
            android:layout_width="match_parent"
            android:layout_alignParentBottom="true"
            android:text="Aplicar"/>
    </RelativeLayout>

</LinearLayout>

Цель состоит в том, чтобы клавиатура перекрывала макет.

Как я могу предотвратить перемещение экрана, когда клавиатура видно? Вы можете мне помочь?

Ответы [ 2 ]

0 голосов
/ 25 мая 2020

Протестируйте

<activity android:name=".UserRegistration"
    android:windowSoftInputMode="adjustNothing">

Подскажите результат после теста

0 голосов
/ 25 мая 2020

в xamarin native andorid используйте этот синтаксический код на вашем Activity для предотвращения перемещения экрана:

Window.SetSoftInputMode(SoftInput.AdjustNothing);
...