Xamarin Forms Listview的Entry与自定义选择器冲突

时间:2018-10-23 08:52:34

标签: c# android listview xamarin.forms

我的应用程序发生了一个非常奇怪的问题,我有一个自定义选择器,在列表视图的标题,XAML和C#代码中都有一个图像:

/android_asset

以及在视单元格中具有条目的listview,XAML和C#代码:

<controls:CustomPicker Image="arrow" x:Name="filter1" SelectedIndexChanged="filter1_SelectedIndexChanged" HorizontalOptions="FillAndExpand" BackgroundColor="Transparent" TextColor="Black" Title="Category">
                                <controls:CustomPicker.Margin>
                                    <OnIdiom Phone="8,8,8,8" Tablet="12,12,12,12"/>
                                </controls:CustomPicker.Margin>
                                <controls:CustomPicker.FontSize>
                                    <OnIdiom Phone="16" Tablet="24"/>
                                </controls:CustomPicker.FontSize>
                            </controls:CustomPicker>

 public async void filter1_SelectedIndexChanged(object sender, EventArgs e)
        {
            index = 0;
            var selected = filter1.Items[filter1.SelectedIndex];
            for (int i = 0; i < mylist.Count; i++)
            {
                if (mylist[i].description == selected && selected != null && selected != "")
                {
                    await GetItemsCategorized(mylist[i].code, index, searching.Text);
                }
            }
        }

当我在Android上显示listview时,事情就在android上,当我关注每个视单元上的条目时,使用键盘启用了选择器,并且键盘消失了!!!!在iOS上运行正常:

focusing on entry-android

focused on entry-android

focused on entry-ios

知道为什么会这样吗!!

1 个答案:

答案 0 :(得分:0)

自定义选择器放置在列表视图的标题中,我将其放置在列表视图之外,应用程序现在可以正常工作!