mercredi 20 mai 2015

Rendering Problems in android studio (android.support.v4.widget.DrawerLayout)

i try to add sliding menu to my app and i get this message on android studio xml preview :

Rendering Problems The following classes could not be found: - android.support.v4.widget.DrawerLayout (Fix Build Path, Create Class)
Tip: Try to build the project.

this is my xml code :

<android.support.v4.widget.DrawerLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:app="http://ift.tt/GEGVYd"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <!-- Put what you want as your normal screen in here, you can also choose for a linear layout or any other layout, whatever you prefer -->




</FrameLayout>



<!-- The navigation drawer -->
<RelativeLayout
    android:id="@+id/left_drawer"
    android:layout_width="250dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:divider="@android:color/transparent"
    android:dividerHeight="0dp"
    android:clickable="true">

    <ImageView
        android:id="@+id/imageView_bg"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="centerCrop" />

    <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="250dp"
        android:layout_height="match_parent"

        >
        <LinearLayout
            android:id="@+id/drawerLinearLayout"
            android:orientation="vertical"
            android:layout_width="250dp"
            android:layout_height="wrap_content"
            android:divider="@android:color/transparent"
            android:dividerHeight="0dp"
            >

            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent">


            </RelativeLayout>

    </LinearLayout>
</ScrollView>

</RelativeLayout>

and this is gradle.build :

apply plugin: 'com.android.application'

android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
flavorDimensions "api", "abi"
defaultConfig {
    applicationId "com.test.test"
    minSdkVersion 17
    targetSdkVersion 20
    versionCode 2
    versionName "0.0.34"
  }
   buildTypes {
      release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-rules.pro'
      }
    }
   productFlavors {
    }
   }

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// You must install or update the Google Repository through the SDK manager to use this dependency.
 compile 'com.google.android.gms:play-services:6.1.71'
 compile 'com.squareup.picasso:picasso:2.5.2'
 compile 'com.android.support:support-v4:20.0.0'
}

when i try to build and run application its work fine but i cant see preview in android studio.

how can i solve this problem ?

Aucun commentaire:

Enregistrer un commentaire