【问题标题】:How can i see the xml Drawerlayout file on android studio我如何在 android studio 上查看 xml Drawerlayout 文件
【发布时间】:2015-01-09 10:39:23
【问题描述】:

我正在 android studio 上创建 XML 抽屉布局文件,但无法在 android studio 上预览我收到此错误我该如何解决问题

<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:layout_height="match_parent">
<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
<ListView android:id="@+id/left_drawer"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="@android:color/transparent"
    android:dividerHeight="0dp"
    android:background="#fff"/>

我收到此错误:

渲染问题找不到以下类:android.support.v4.widget.Drawer Layout (Fix Build Path, Create Class) 提示:尝试构建项目。

【问题讨论】:

    标签: android xml android-activity android-fragments


    【解决方案1】:

    问题是您可能使用了较低的 minSdkVersion。我遇到了同样的问题,我将 minSdkVersion 设置为 14,将其更改为 17(在 build.gradle 中)并且它可以正确呈现。

    也可能是 Android 支持库问题

    步骤

    右键项目->Android工具->添加支持库。

    然后我刚刚清理了项目并为我工作......

    显然检查Android库和其他库...

    【讨论】:

    • 如果使用android.support 的部分目的是提供向后支持,我不明白为什么我必须增加minSdkVersion...
    猜你喜欢
    • 1970-01-01
    • 2020-06-21
    • 1970-01-01
    • 2016-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-23
    相关资源
    最近更新 更多