答案 0 :(得分:0)
如此处所述,您可以使用Rg.Plugins.Popup来满足您的要求。我编写了一些简单的代码,您可以看看:
操作菜单页面,它继承了model.compile(optimizer='adam',
loss=my_funky_loss_fn,
metrics=['accuracy'])
,我使用listView来显示选择,您可以自定义PopupPage
在右侧添加图像。还要处理viewCell
中的点击事件:
ListView_ItemSelected
在Xaml中:
public partial class Page1 : PopupPage
{
public Page1 ()
{
InitializeComponent ();
listView.ItemsSource = new List<string>
{
"first",
"second",
"third",
"fourth",
"fifth",
};
}
private async void OnClose(object sender, EventArgs e)
{
await PopupNavigation.Instance.PopAsync();
}
private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{
//
var index = (listView.ItemsSource as List<string>).IndexOf(e.SelectedItem as string);
Console.WriteLine(index);
}
}
要使用此页面:
<StackLayout VerticalOptions="End" HorizontalOptions="FillAndExpand" Padding="20, 20, 20, 20" >
<Frame CornerRadius="25" Padding="0" Margin="0,0,0,0" BorderColor="Red" HasShadow="False" IsClippedToBounds="True">
<StackLayout BackgroundColor="White" VerticalOptions="End" >
<ListView x:Name="listView" HeightRequest="250" RowHeight="50" ItemSelected="ListView_ItemSelected">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell TextColor="Black" Text="{Binding .}"></TextCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</Frame>
<Frame CornerRadius="25" Padding="0" BackgroundColor="White" IsClippedToBounds="True">
<StackLayout BackgroundColor="White" VerticalOptions="End" HeightRequest="50">
<Button Text="Close" TextColor="#A9D1DE" Clicked="OnClose"></Button>
</StackLayout>
</Frame>
</StackLayout>
您应该修改详细信息以满足您的要求。例如自定义 await PopupNavigation.Instance.PushAsync(new Page1());
,禁用viewCell
的滚动功能等。
这是iOS中的样子: