Android 在自定义对话框中使用ListFragment会出现问题并显示膨胀类片段的错误
IAndroid 在自定义对话框中使用ListFragment会出现问题并显示膨胀类片段的错误,android,xml,Android,Xml,IListFragment具有多个映射,具有自定义的对话框fragment。它显示出一些错误。 我被困在那里了,帮帮我 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout
ListFragment
具有多个映射,具有自定义的对话框fragment
。它显示出一些错误。
我被困在那里了,帮帮我
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/sky_blue"
android:orientation="vertical">
<TextView
android:id="@+id/upcomingShifts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/black"
android:textSize="@dimen/text_size_24sp"
android:padding="@dimen/padding_10dp"
android:text="@string/upcoming_shifts"/>
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/lvMapFragment"
class="android.support.v4.app.ListFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
</LinearLayout>
您可以尝试更改布局 您的代码:
<fragment
android:id="@+id/lvMapFragment"
class="android.support.v4.app.ListFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
新代码:
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="package_name_of_your_class_that_extends_ListFragment"
android:id="@+id/lvMapFragment"
tools:layout="@layout/name_of_your_layout_use_in_above_class"
/>
请显示膨胀布局的代码以及错误日志。请也发布错误。android.view.InflateException:二进制XML文件行#23:膨胀类碎片出错在我的情况下不起作用,因为我没有扩展listfragment
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="package_name_of_your_class_that_extends_ListFragment"
android:id="@+id/lvMapFragment"
tools:layout="@layout/name_of_your_layout_use_in_above_class"
/>