[HorizontalListView] Current index reset to zero when a ViewCell Entry get focus
See original GitHub issue- OS: Android
- Device: Huawei P20 Lite
- Sdk vervion: Android SDK 27
- Xamarin.Forms: 3.6.0.344447
I am using HorizontalListView as a carousel. There is an Entry in it. But when I set HorizontalTextAlignment of the Entry to Center, current index of HorizontalListView is reset to zero. When I don’t set HorizontalTextAlignment it works well. I have the same problem when I use a custom renderer of Entry and I set Gravity to Center.
XAML :
<renderedViews:HorizontalListView x:Name="FruitList" ColumnCount="1" HorizontalOptions="FillAndExpand" ItemSpacing="0" ListLayout="Linear" ScrollSpeed="Slowest" SnapStyle="Center" VerticalOptions="FillAndExpand"> <renderedViews:HorizontalListView.ItemTemplate> <DataTemplate> <ViewCell> <StackLayout> <Label HorizontalTextAlignment="Center" Text="{Binding .}" VerticalTextAlignment="Center" /> <Entry HorizontalTextAlignment="Center" Placeholder="Entry" /> </StackLayout> </ViewCell> </DataTemplate> </renderedViews:HorizontalListView.ItemTemplate> </renderedViews:HorizontalListView>
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)

Top Related StackOverflow Question
Hi, im currently having the same problem that the HorizontaList automatically scrolls to the beginning when a User taps on a Control that takes input from the user ( e.g. Entry or Picker). The Cursor stays in the Control the User tapped but the List now displays the first item. This behaviour only occurs when the HorizontalTextAlignment Property is set on the Control the User taps and the List’s layout is linear or Carousel. When HorizontalTextAlignment is not set, the HorizontalList just works fine with linear and Carousel layout. I also tried the CarouselView of Xamarin.Forms instead of the HorizontalList but the same behaviour occured when the HorizontalTextAlignment property was set. Maybe this Issue is not directly caused by the HorizontalListView Library. Is it possible that something in Xamarin.Forms is not working as excpected, which causes this weird behaviour?
Xamarin Forms Version: 5.0.0.2012 Sharpnado.Forms.HorizontalListView Version: 1.8.2 Thanks for any help in advance and all the people who created this awesome Library 😃
“HorizontalTextAlignment” of the entry matters, what a bug!