在Moto G4设备(Android 7.0)上,查看下面的示例页面时,第一个单元格中的第一个条目是唯一一个始终获得焦点的条目。
我认为这是由于当键盘出现并移动内容时从ListView开始运行的布局循环。该布局循环尝试处理设置焦点并决定第一个条目获胜。
我不确定为什么这是设备特定问题。任何帮助将不胜感激。
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
x:Class="EntryBug.MainPage">
<ListView VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
HasUnevenRows="True">
<ListView.ItemsSource>
<x:Array Type="{x:Type system:String}">
<system:String>Testing 1</system:String>
<system:String>Testing 2</system:String>
<system:String>Testing 3</system:String>
<system:String>Testing 4</system:String>
<system:String>Testing 5</system:String>
<system:String>Testing 6</system:String>
<system:String>Testing 7</system:String>
<system:String>Testing 8</system:String>
<system:String>Testing 9</system:String>
<system:String>Testing 10</system:String>
</x:Array>
</ListView.ItemsSource>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.Children>
<Label Grid.Row="0"
Grid.Column="0"
TextColor="Black"
Text="{Binding .}"/>
<Entry Grid.Row="1"
Grid.Column="0"
TextColor="Black"/>
</Grid.Children>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ContentPage>