2016-05-02 17 views
0

最初はすべてうまくいき、その後エラーが発生しました。FloatinActionButton:以下のクラスをインスタンス化できませんでした

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true" 
tools:openDrawer="start"> 

<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom|end" 
    android:layout_margin="@dimen/fab_margin" 
    android:src="@android:drawable/ic_dialog_email" /> 

</android.support.v4.widget.DrawerLayout> 

もエラーjava.lang.IllegalArgumentExceptionあり:gravity LEFT

依存関係が見つかりません引き出しビュー:

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
testCompile 'junit:junit:4.12' 
compile 'com.android.support:appcompat-v7:23.2.0' 
compile 'com.android.support:design:23.2.0' 
} 

答えて

0

、あなたのグレードのファイルに依存関係としてサポートv4のライブラリを必要とするのでそれはあるが、あなたはv7しか持っていません。

つまり、あなたの依存関係に(最後の行)、これを追加することができます。

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.2.0' 
    compile 'com.android.support:design:23.2.0' 
    compile 'com.android.support:support-v4:23.3.0' 
} 
関連する問題