我试图弄清楚要为此类强制转换例程做些什么。我直接关注斯图尔特的例子,我似乎被困在这里。任何帮助将不胜感激。
Android.Views.InflateException:类型' Android.Views.InflateException'的异常被扔了。
java.lang.ClassCastException: md5d958475ca14cd4931af92c1266ed3aa8.DrawerFragment无法强制转换为 android.app.Fragment
DrawerFragment扩展了MvxFragment
var drawerFragment = (DrawerFragment)this.SupportFragmentManager.FindFragmentById(Resource.Id.drawer_fragment);
在.axml中添加片段:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="@+id/myDrawer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Main Content View-->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
class="Sample.Android.Views.DrawerFragment"
android:id="@+id/drawer_fragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</FrameLayout>
<!-- The navigation drawer Layout -->
<Mvx.MvxListView
android:id="@+id/leftListView"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:choiceMode="singleChoice"
android:divider="#D2D2D2"
android:dividerHeight="2dp"
android:background="#F2F2F2"
local:MvxBind="ItemsSource DrawerItems"
local:MvxItemTemplate="@layout/simple_list_item" />
</android.support.v4.widget.DrawerLayout>