iOS - keyboard overlapping entry

MikilllMikilll Member ✭✭✭

I was searching over the Internet but I have not found a working solution for my problem.

FIRST SCREEN

SECOND SCREEN

As you can I have a simple layout with ListView, and below the ListView i have a fixed footer which is always visible. It does not scroll with the ListView.

On iOS when I am tapping the entry the keyboard is overlapping the Entry. On Android this problem does not exist. How to solve that problem?

Here is my XAML

<StackLayout>
      <ListView>
        {{ A LOT OF DATA }}
            </ListView>
            <StackLayout "> <!-- Here is a footer -->
                <BoxView HeightRequest="1" Color="Black"/>
                <Grid VerticalOptions="CenterAndExpand" Margin="10,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                     <Label Grid.Column="0" Text="label" VerticalTextAlignment="Center" />
                     <Entry Grid.Column="1"/> <!-- This entry causes a problem -->
                     <Label Grid.Column="2" Text="xx" VerticalTextAlignment="Center" />
                    <Button Grid.Column="3" Text="button" />
                </Grid>
            </StackLayout>
</StackLayout>

The difficult part is that as you can see my entry which causes a problem is not inside a ScrollView because I want it to be always visible.

I saw some solutions which are working when your entire page is inside the ScrollView but this not my case.

I will be really grateful for any help.

Best Answer

  • LandLuLandLu Xamurai
    Accepted Answer

    You could install Xamarin.IQKeyboardManager on your iOS project.
    Then enable it in the AppDelegate:

    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        global::Xamarin.Forms.Forms.Init();
    
        IQKeyboardManager.SharedManager.Enable = true;
    
        LoadApplication(new App());
    
        return base.FinishedLaunching(app, options);
    }
    

    When you want to turn it off, make a dependency service to disable it on iOS project.

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai
    Accepted Answer

    You could install Xamarin.IQKeyboardManager on your iOS project.
    Then enable it in the AppDelegate:

    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        global::Xamarin.Forms.Forms.Init();
    
        IQKeyboardManager.SharedManager.Enable = true;
    
        LoadApplication(new App());
    
        return base.FinishedLaunching(app, options);
    }
    

    When you want to turn it off, make a dependency service to disable it on iOS project.

  • MikilllMikilll Member ✭✭✭

    @LandLu Thank you so much. WORKS LIKE A CHARM!

Sign In or Register to comment.