当NullPointerException:name==null时,在哪里命名我的片段
我看到了这个答案:
NullPointerException: name == null
在我的片段XML中尝试过这样做:
<FrameLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
xmlns:tools="http://schemas.安卓.com/tools"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
tools:context="com.OscarJunker.resturantlocaterexample.pcbuilderhandbook.pcbuilderhandbook.FrontFragment">
<!-- TODO: Update blank fragment layout -->
<fragment
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:id="@+id/front_fragment"
安卓:name="com.OscarJunker.resturantlocaterexample.pcbuilderhandbook.pcbuilderhandbook.FrontFragment"
/>
<TextView
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
安卓:text="@string/hello_blank_fragment"
安卓:layout_gravity="center_horizontal|top"
/>
但我有一个错误:java。lang.IllegalArgumentException:二进制XML文件行#8
我试图将我的片段放入应用程序中,并使用java代码进行事务处理
<安卓.support.v4.widget.DrawerLayout
xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
xmlns:tools="http://schemas.安卓.com/tools"
安卓:id="@+id/drawer_layout"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
tools:context=".MainActivity">
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<FrameLayout
安卓:id="@+id/container"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
/>
安卓:name="com.OscarJunker.resturantlocaterexample.pcbuilderhandbook.pcbuilderhandbook.FrontFragment"
<!-- 安卓:layout_gravity="start" tells DrawerLayout to treat
this as a sliding drawer on the left side for left-to-right
languages and on the right side for right-to-left languages.
If you're not building against API 17 or higher, use
安卓:layout_gravity="left" instead. -->
<!-- The drawer is given a fixed width in dp and extends the full height of
the container. -->
<fragment 安卓:id="@+id/navigation_drawer"
安卓:layout_width="@dimen/navigation_drawer_width"
安卓:layout_height="match_parent"
安卓:layout_gravity="start"
安卓:name="com.OscarJunker.resturantlocaterexample.pcbuilderhandbook.pcbuilderhandbook.NavigationDrawerFragment"
tools:layout="@layout/fragment_navigation_drawer" />
共 (0) 个答案