floating action button - Error inflating class android.support.design.widget.CoordinatorLayout -
i use floatingactionbutton on application, read : https://guides.codepath.com/android/floating-action-buttons#google-s-official-support-library when run activity have error :
java.lang.runtimeexception: unable start activity componentinfo{com.xavier_laffargue.podcast/com.xavier_laffargue.podcast.act_test}: android.view.inflateexception: binary xml file line #1: error inflating class android.support.design.widget.coordinatorlayout
xml file
<android.support.design.widget.coordinatorlayout android:id="@+id/main_content" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <listview android:id="@+id/lvtodolist" android:layout_width="match_parent" android:layout_height="match_parent"></listview> <android.support.design.widget.floatingactionbutton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|right" android:layout_margin="24dp" android:src="@drawable/ic_action_refresh" app:layout_anchor="@id/lvtodolist" app:layout_anchorgravity="bottom|right|end" /> </android.support.design.widget.coordinatorlayout>
graddle
*apply plugin: 'com.android.application' android { compilesdkversion 21 buildtoolsversion "21.1.2" defaultconfig { applicationid "com.xavier_laffargue.podcast" minsdkversion 21 targetsdkversion 20 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.android.support:support-v4:22.2.0' compile 'com.android.support:design:22.2.0' compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:support-v13:22.2.0' compile 'com.android.support:cardview-v7:21.0.+' compile 'com.android.support:recyclerview-v7:21.0.+' }
please change appcompatactivity if use activity. becomes error when activity.
Comments
Post a Comment