Keyboard hides tapped Entry

Hi,

when tapping an Entry that is inside a SFListView close to the bottom of the page, the keyboard overlaps the Entry (Only tested on Android)
instead of pushing/scrolling it up.
Is there a way to show the tapped entry?

I've seen workarounds with placing the SFListView inside a scrollview, but with this i had blank space underneath the List.





8 Replies 1 reply marked as answer

LN Lakshmi Natarajan Syncfusion Team February 24, 2021 10:51 AM UTC

Hi Viana, 
 
Thank you for using Syncfusion products. 
 
We have checked the reported query “Keyboard hides tapped Entry” from our side. We would like to inform that you can overcome the reported scenario by loading the SfListView in the ScrollView. Please refer to the following code snippets, 
 
XAML 
<ContentPage.Content> 
    <ScrollView> 
        <syncfusion:SfListView x:Name="listView" ItemSize="60" ItemsSource="{Binding ContactsInfo}"> 
            <syncfusion:SfListView.ItemTemplate > 
                <DataTemplate> 
                    <Grid x:Name="grid"> 
                        <Grid.ColumnDefinitions> 
                            <ColumnDefinition Width="70" /> 
                            <ColumnDefinition Width="*" /> 
                        </Grid.ColumnDefinitions> 
                        <Image Source="{Binding ContactImage}" VerticalOptions="Center" HorizontalOptions="Center" HeightRequest="50" WidthRequest="50"/> 
                        <Grid Grid.Column="1" RowSpacing="1" Padding="10,0,0,0" VerticalOptions="Center"> 
                            <Entry TextColor="#474747" Text="{Binding ContactName}"/> 
                        </Grid> 
                    </Grid> 
                </DataTemplate> 
            </syncfusion:SfListView.ItemTemplate> 
        </syncfusion:SfListView> 
    </ScrollView> 
</ContentPage.Content> 
 
Also, you can disable the ListView scrolling by using the IsScrollingEnabled as False. Please refer our document here, 
 
We suggest you to set the platform configuration as mentioned below, 
namespace ListViewXamarin.Droid 
{ 
    [Activity(Label = "ListViewXamarin", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 
    { 
        protected override void OnCreate(Bundle savedInstanceState) 
        { 
            TabLayoutResource = Resource.Layout.Tabbar; 
            ToolbarResource = Resource.Layout.Toolbar; 
 
            base.OnCreate(savedInstanceState); 
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState); 
            LoadApplication(new App()); 
            Xamarin.Forms.Application.Current.On<Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize); 
        } 
    } 
} 
 
Please refer to the following discussion here, 
 
We have attached the tested sample in Android and iOS and you can download from the following link, 
 
Additionally, you can use the KeyboardOverlap plugin which will adjust the view when keyboard appears for iOS. Please refer to the document, 
 
Please let us know if you need further assistance. 
 
Lakshmi Natarajan 
 


Marked as answer

VI Viana February 24, 2021 10:58 PM UTC

Hi,

thanks for your help.
Setting IsScrollingEnabled to False and padding value > 0 will crash the entire App.
Can you confirm this issue?
Removing the padding value resolves all my problems so far.



                                                                   ItemsSource="{Binding Exercises}" Padding="10" SelectionMode="None" AutoFitMode="Height"
                                       DragStartMode="OnHold" ItemSpacing="10,5,10,0" AllowSwiping="True"
                                       SwipeOffset="{Binding ScreenWidth}" SwipeThreshold="150" SwipeEnded="ListView_SwipeEnded"
                                        ItemDragging="HLV_ItemDragging" BackgroundColor="Green"  IsScrollingEnabled="False">

===================================================
==============
    Managed Stacktrace:
=================================================================
      at System.Collections.Generic.Dictionary`2:TryGetValue <0x00000>
      at Xamarin.Forms.BindableObject:GetContext <0x00083>
      at Xamarin.Forms.BindableObject:GetValue <0x000d3>
      at Syncfusion.ListView.XForms.SfListView:get_IsScrollingEnabled <0x00063>
      at Syncfusion.ListView.XForms.SfListView:OnMeasure <0x000e7>
      at Xamarin.Forms.VisualElement:GetSizeRequest <0x00313>
      at Xamarin.Forms.Layout:GetSizeRequest <0x001c3>
      at Xamarin.Forms.VisualElement:Measure <0x002c3>
      at Syncfusion.ListView.XForms.SfListView:OnMeasure <0x00ae7>
      at Xamarin.Forms.VisualElement:GetSizeRequest <0x00313>
...


LN Lakshmi Natarajan Syncfusion Team February 25, 2021 10:39 AM UTC

Hi Viana, 
 
Thank you for the update. 
 
We would like to inform you that the reported issue is related to framework. Please refer to the following discussions regarding the same, 
 
Also, you can use SfListView.ItemSpacing property instead of Padding to handle the padding effect. Please refer to our user guidance for the same, 
 
Please let us know if you need further assistance. 
 
Lakshmi Natarajan 
 



VI Viana February 25, 2021 05:39 PM UTC

Thank you very much.
The only issue left is that with the sflistview inside the scrollview, scrolling while drag&dropping is not possible anymore.
Is there a solution for this problem?


LN Lakshmi Natarajan Syncfusion Team February 26, 2021 11:15 AM UTC

Hi Viana, 
 
Thank you for the update. 
 
We have checked the reported query “with the sflistview inside the scrollview, scrolling while drag&dropping is not possible anymore” from our side. We would like to inform you that when IsScrollingEnabled is false for ListView, then the default scrolling will be disabled. This is the expected behavior in SfListView scrolling. We have mentioned the same in our user guidance document. Please find the same in the following link, 
 
Hence, we suggest you to use the IsScrollingEnabled as True for SfListView to overcome the reported scenario. Please let us know if you need further assistance. 
 
Regards, 
Lakshmi Natarajan 



VI Viana February 27, 2021 12:19 AM UTC

Thank you very much.
As long as the Scrollview with the SFListView is the only content on a page, everything works fine.

But when you place something above the Scrollview, for example a custom navigation bar (via Grid or StackLayout), scrolling while dragging an item does not work right.
It seems like the SfListview thinks it has the height of the whole page and only scrolls up when you drag the item out of the Listview to the very top of the page.

<code>
<ContentPage.Content>
     <Grid RowDefinitions="200,*">

          <ScrollView Grid.Row="1">
                <syncfusion:SfListView x:Name="HLV"   ItemsSource="{Binding Items}" SelectionMode="None" AutoFitMode="Height"
                                       DragStartMode="OnHold" ItemSpacing="10,5,10,0" AllowSwiping="True"
                                       SwipeOffset="{Binding ScreenWidth}" SwipeThreshold="150" SwipeEnded="ListView_SwipeEnded"
                                        ItemDragging="HLV_ItemDragging"  IsScrollingEnabled="True">    
                </syncfusion:SfListView>
          </ScrollView>
     </Grid>
</ContentPage.Content>
</code>

Is it somehow possible to have a view above the scrollview with all previous discussed features of the SfListView?




VI Viana February 27, 2021 02:19 PM UTC

I found out what the problem is. When the SFListView is higher than the view of the ScrollView, the ScrollView begins to scroll at some point.
Then, the ScrollView scrolls the top or bottom (depending on your scroll direction) of the SFListView out of the ScrollView.
The consequence is that when you drag an item and want the list to scroll, at first it wont because the point at which the SFListView will trigger the scroll is outside of the ScrollView.

I built myself a workaround:
- I set ScrollView (Name = "Sv") to Orientation="Neither"
- Giving my Entries a Focus and Unfocus Event:
private void SetEntry_Focused(object sender, FocusEventArgs e)
        {
            if (e.IsFocused)
                Sv.Orientation = ScrollOrientation.Vertical;
            else if(!e.IsFocused)
                Sv.Orientation = ScrollOrientation.Neither;
        }
- Giving the ScrollView a Scrolled Event:
 private void Sv_Scrolled(object sender, ScrolledEventArgs e)
        {
            ((ScrollView)sender).Orientation = ScrollOrientation.Neither;
        }

That means that the scroll of the ScrollView is disabled until an entry is tapped.
When the keyboard opens, the Scroll of the Scrollview is enabled to let the Entry push up.
When the user closes the keyboard, the Scrollview gets disabled again.


LN Lakshmi Natarajan Syncfusion Team March 1, 2021 07:39 AM UTC

Hi Viana, 
 
Thank you for the update. 
 
We are glad that reported issue have been resolved at your end. Please let us know if you need any further update. As always we are happy to help you out. 
 
Regards, 
Lakshmi Natarajan 
 


Loader.
Up arrow icon