我正在为一个安卓应用程序使用xamarin.forms,我需要显示一个警告,左边是,右边是。我可以将YES切换为NO,NO切换为YES,但当在警报之外单击时,默认情况下它会将其视为YES。
我怎样才能做到这一点呢?
发布于 2018-08-31 20:43:36
我使用这样的东西,它工作得很好,尽管我注意到它可能不是面向未来的。如果用户没有点击YES,显示就会消失,不会做任何其他事情。
bool continue_logout = false;
try
{
continue_logout = await DisplayAlert("Logout", "If you logout, you also clear the cache of all data. Are you sure you want to continue?", "Yes", "No");
if (continue_logout)
{
// Clean up stuff and clear out user settings
}
}
catch {
}
finally
{
if (continue_logout)
App.Current.MainPage = new NavigationPage(new LoginPage());
}
https://stackoverflow.com/questions/52115074
复制相似问题