0

I'm developing an Android Layout with Xamarin. When the keyboard is visible, the layout is compressed.

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

The goal is for the keyboard to overlay the layout.

How can I prevent the screen from moving when the keyboard is visible? Can you help me?

4
  • Actually I'm using the weight property of LinearLayout to divide the layout. It looks that when the keyboard appears the weight sum its equal to the available screen and not the entire display.
    – fvamaro
    May 25, 2020 at 19:36
  • Can you post your code? If you do not post related code, we cannot guess what is your layout.
    – Leon
    May 26, 2020 at 5:46
  • there u have it
    – fvamaro
    May 26, 2020 at 8:06
  • Do you have a edittext in the Common.Droid.UI.Controls.NXButton? If the keyboard is visible, make the above layout cannot be compressed and edittext could be seen, you should add WindowSoftInputMode = SoftInput.AdjustPan in [Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true,WindowSoftInputMode = SoftInput.AdjustPan)]
    – Leon
    May 26, 2020 at 8:45

2 Answers 2

0

Test it

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

Tell me the result after the test

1
  • Unfortunately it didn't work, Actually I'm using the weight property of LinearLayout to divide the layout. It looks that when the keyboard appears the weight sum its equal to the available screen and not the entire display.
    – fvamaro
    May 25, 2020 at 19:40
0

in xamarin native andorid use this syntax code on your Activity for prevent the screen moving:

Window.SetSoftInputMode(SoftInput.AdjustNothing);
3
  • Unfortunately it didn't work, Actually I'm using the weight property of LinearLayout to divide the layout. It looks that when the keyboard appears the weight sum its equal to the available screen and not the entire display.
    – fvamaro
    May 25, 2020 at 19:40
  • can you send your xml code to my email address? maybe i can help you May 25, 2020 at 19:52
  • your layout is not complete, plz send your complete layout May 26, 2020 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.