【发布时间】:2015-05-09 22:22:07
【问题描述】:
我正在 android studio 上创建 XML 抽屉布局文件,但无法在 android studio 上预览我收到此错误我该如何解决问题
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#ff6600"
android:paddingRight="@dimen/activity_horizontal_margin"
tools:context="br.com.appingles.Tela2" >
<include android:id="@+id/app_bar" layout="@layout/app_bar"/>
<TextView
android:id="@+id/assertosTela2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="20dp"
android:text="TextView" />
<TextView
android:id="@+id/perguntaTela2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="28dp"
android:text="TextView" />
<Button
android:id="@+id/button2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:onClick="button2"
android:text="Button2" />
<Button
android:id="@+id/button3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="27dp"
android:onClick="button3"
android:text="Button3" />
<Button
android:id="@+id/button4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:onClick="button4"
android:text="Button4" />
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="58dp"
android:onClick="button1"
android:text="Button1" />
</LinearLayout>
<fragment
android:id="@+id/fragment_navigation_drawer"
android:layout_width="@dimen/nav_dr"
android:layout_height="match_parent"
android:layout_gravity="start"
app:layout="@layout/fragment_navigation_drawer"
android:name="br.com.appingles.NavigationDrawerFragment"
tools:layout="@layout/fragment_navigation_drawer"
/>
android {
compileSdkVersion 22
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "br.com.appingles"
minSdkVersion 17
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:22.1.1'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:recyclerview-v7:22.1.1'
}
我收到此错误:
渲染问题 找不到以下类:android.support.v4.widget.Drawer Layout (Fix Build Path, Create Class) 提示:尝试构建项目。
【问题讨论】:
-
这个?编译'com.android.support:support-v4:22.1.1'
-
在你的 xml 文件中我没有看到抽屉。
-
第一次入栈,忘记添加完整代码,现在编辑添加完毕。
标签: android xml android-studio drawerlayout