首页 > 解决方案 > Xamarin Forms Android 上的选取器问题

问题描述

我有一个使用如下选择器的 Xamarin Forms 应用程序。在 Windows 上它工作正常,但在 Android 上,当尝试选择一个项目时,选择器项目会显示多次。我注意到当我将 Android 目标从 Android 7 更改为 Android 8 时开始发生这种情况。有没有人也遇到过这个问题?是否有可用的修复/解决方法?

谢谢保罗。

<ListView x:Name="ListViewExInspection" 
                      HasUnevenRows="True"
                      ItemsSource="{Binding ExInspectionDetail}">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout Padding="0,0,15,1">
                                <Label FontSize="Small" Text="{Binding InspectionSection}" TextColor="Black" FontAttributes="Bold"/>
                                <Label FontSize="Small" Text="{Binding InspectionText}" VerticalOptions="Start" TextColor="Black"/>
                                <Label FontSize="Small" Text="Status" TextColor="Black" FontAttributes="Bold"/>
                                <Picker x:Name="PkStatus" TextColor="Black" FontSize="Small"
                                                SelectedIndex="{Binding InspectionStatus, Mode=TwoWay}"
                                                IsEnabled="{Binding StatusEnabled}">
                                    <Picker.ItemsSource>
                                        <x:Array Type="{x:Type x:String}">
                                        <x:String>Incomplete</x:String>
                                        <x:String>Pass</x:String>
                                        <x:String>Fail</x:String>
                                        <x:String>N/A</x:String>
                                        </x:Array>
                                    </Picker.ItemsSource>
                                </Picker>
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

标签: androidxamarin.forms

解决方案


推荐阅读