0
votes

I am using SearchBar class in Xamarin Forms The problem is when I focus on the searchBar text box the Keyboard shown like in the following image, It splits the screen vertically into two sections one for the view and the other for the keyboard, however, what i would like to achieve is the view should remain in the same height meanly occupy the whole screen height and the keyboard should overlap the view without compressing it. Any help?

Note: when I focus on any other text box the keyboard works as expected, meanly the problem is only with the search bar text box.

enter image description here

2
Are your other text boxes Editors ? I cannot reproduce your issue, their behaviors seems to be the same by my side. Could you please provide more details about your issue? Maybe the code of your layout? And your emulator info? - Grace Feng
It is hard to share the code because of a couple of reasons the first one is it is complex the second one our company privacy. this issue shown in every emulator and real devices so, I think the reason behind this issue is not the emulator, however, this is an visual studio android emulator, 10.1 KitKat (4.4) XHDPI Tablet API level 19 KitKat Similar to Samsung Google Nexus 10 - Motaz

2 Answers

1
votes

I wasn't able to reproduce this either with a sample app, but the issue seems related to the SoftInputMode. By default Forms uses AdjustPan however when you focus on the SearchBar it sounds like it's using the AdjustResize behavior.

You can try using the new Platform Specifics feature in Forms 2.3.3 to see if it forces the SearchBar to use AdjustPan. With it you can set the Android input mode on an application or page level.

0
votes

I have solved the problem using the following code OnCreate method on MainActivity class On android project:

public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);
        LoadApplication(new App());

        var window = ((Activity)Forms.Context).Window;
        window.SetSoftInputMode(SoftInput.AdjustPan);

    }

}