我已经做了一些搜索,似乎人们有我的问题通常是从api级别11-14左右移动。我已经让我的应用程序在api级别21处100%工作,并且我试图将其降低到19。
我添加了
compile 'com.android.support:appcompat-v7:+'
到我的gradle,并交换了我的类来扩展SupportActionBar。
然而,当我在kitkat设备上运行我的应用程序时,我得到了
android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.ListView
这是相关的XML文件:
<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="@drawable/bg2">
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- 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.
If you're not building against API 17 or higher, use
android:layout_gravity="left" instead. -->
<!-- The drawer is given a fixed width in dp and extends the full height of
the container. -->
<fragment
android:id="@+id/navigation_drawer"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:name="com.xxx.toolbox.NavigationDrawerFragment"
tools:layout="@layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>
我非常感谢你提供任何帮助。
编辑:正如普通软件指出的那样,可能是这个xml文件抛出了错误。非常感谢。<ListView 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/black_semi_transparent"
android:choiceMode="singleChoice"
android:divider="@color/CuriousBlue"
android:dividerHeight="1dp"
tools:context=".NavigationDrawerFragment" />