【发布时间】:2022-07-08 05:21:41
【问题描述】:
首先这个帖子与那个帖子有关:Xamarin Forms Android Error inflating class MaterialCalendarGridView
在我发布任何代码之前:Xamarin Forms 的 Flyout 配置是正确的!如果我在弹出页面中设置IsPresented = true;,弹出菜单会正确显示,我唯一遇到的问题是,Android 上完全没有顶部工具栏和汉堡菜单图标。
这里是我MainActivity.cs的定义:
[Activity(ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, ScreenOrientation = ScreenOrientation.Portrait, LaunchMode = LaunchMode.SingleTop, MainLauncher = true, Theme = "@style/MyTheme")]
[IntentFilter(new[] { Intent.ActionView},
DataScheme = "https",
DataHost = "myapp.com",
AutoVerify = true,
Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable})]
[IntentFilter(new[] { Intent.ActionView },
DataScheme = "http",
DataHost = "myapp.com",
AutoVerify = true,
Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable })]
public class MainActivity : FormsAppCompatActivity, Android.Gms.Tasks.IOnSuccessListener
{
....
这是我的style.xml:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<style name="MyTheme" parent="Theme.MaterialComponents.Light">
<item name="android:colorPrimary">#ec1a23</item>
<item name="android:colorPrimaryDark">#dd2c00</item>
<item name="android:colorAccent">#ff3d00</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.Splash" parent="Theme.MaterialComponents.Light">
<item name="android:windowBackground">@drawable/splashscreen</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
正如相关帖子中提到的解决方案,我无法创建toolbar.xml 文件,因为我的应用程序会在启动时崩溃。关于AppCompat 和Flyout 文档,完全没有必要。
我真的不知道这里有什么问题。
【问题讨论】:
-
是不是把工具栏需要的东西去掉了?在我看来,您之前的问题需要以不删除与工具栏相关的 Android xml 行的方式解决。那么这个问题就变得没有意义了。并且可能应该被删除。
标签: c# xamarin xamarin.forms xamarin.ios