【发布时间】:2014-04-26 20:15:38
【问题描述】:
当我在其他计算机上配置我的应用程序时,应用程序崩溃了。检查我的日志猫。我还添加了 android-v4-support.jar。
04-26 11:39:54.695: E/AndroidRuntime(4304): java.lang.RuntimeException:无法启动活动 组件信息{com.rockers.airtasker/com.rockers.airtasker.ProjectHome}: android.view.InflateException:二进制 XML 文件第 19 行:错误 膨胀类 android.support.v4.widget.DrawerLayout
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:background="@android:color/transparent"
android:layout_height="match_parent">
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<!-- android: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.
The drawer is given a fixed width in dp and extends the full height of
the container. A solid background is used for contrast
with the content view. -->
<ListView
android:id="@+id/left_drawer"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#111"/>
</android.support.v4.widget.DrawerLayout>
【问题讨论】:
-
分享您拥有的 xml 布局作为您的
ProjectHome活动的内容视图。 logcat 说问题出在它的第 19 行。 -
请检查我是否添加了 xml 文件
-
终于花了半天时间解决了。我已经为导航抽屉添加了andoid-v13-support.jar,忘记按顺序检查并导出。