在我运行详细信息部分

时间:2018-02-02 18:39:02

标签: android xml android-layout android-studio android-fragments

在我运行详细信息部分时,片段部分中的渲染错误导致应用崩溃:

  

错误:标记允许布局文件在运行时动态包含不同的布局。在布局编辑时,要使用的特定布局是未知的。您可以在编辑布局时选择要预览的布局。        - (使用@ layout / fragment_recipe_detail,使用@ layout / fragment_recipe_detail_content_ingredients_item,选择布局......)

recipe_detail布局代码

<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<fragment
    android:id="@+id/fragment_recipe_detail"
    android:name="com.robotemplates.cookbook.fragment.RecipeDetailFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

这是包含错误的部分:

<fragment
    android:id="@+id/fragment_recipe_detail"

特别是这一行:

    android:name="com.robotemplates.cookbook.fragment.RecipeDetailFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
....

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

删除 android:name="com.robotemplates.cookbook.fragment.RecipeDetailFragment" 来自片段标签和使用 框架布局标记中的tools:context="com.robotemplates.cookbook.fragment.RecipeDetailFragment"