gowong/material-sheet-fab

Error inflating class com.gordonwong.materialsheetfab.sample.Fab

Closed this issue · 4 comments

Hi @gowong

Thanks for the amazing library.

I tried to use your library in your project.
(Initially i tried to copy-paste the sample app files to test the library)

But i'm getting this error
11-19 17:31:48.186 11272-11272/com.roshu.testing123 E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.roshu.testing123/com.roshu.testing123.MainActivity}: android.view.InflateException: Binary XML file line #44: Error inflating class com.gordonwong.materialsheetfab.sample.Fab

This is my XML file (I took it directly from sample app):

<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
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">

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

    <android.support.design.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.design.widget.AppBarLayout
            android:id="@+id/appbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <!-- Toolbar -->
            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                style="@style/Widget.MaterialSheetFab.ToolBar" />

            <!-- Tabs -->
            <android.support.design.widget.TabLayout
                android:id="@+id/tabs"
                style="@style/Widget.MaterialSheetFab.TabLayout" />
        </android.support.design.widget.AppBarLayout>

        <!-- View pager -->
        <android.support.v4.view.ViewPager
            android:id="@+id/viewpager"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/appbar"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    </android.support.design.widget.CoordinatorLayout>

    <!-- Your FAB implementation -->
    <com.gordonwong.materialsheetfab.sample.Fab
        android:id="@+id/fab"
        style="@style/Widget.MaterialSheetFab.Fab"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true" />

    <!-- Overlay that dims the screen -->
    <com.gordonwong.materialsheetfab.DimOverlayFrameLayout
        android:id="@+id/overlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <!-- Circular reveal container for the sheet -->
    <io.codetail.widget.RevealLinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="end|bottom"
        android:orientation="vertical">

        <!-- Sheet that contains your items -->
        <android.support.v7.widget.CardView
            android:id="@+id/fab_sheet"
            style="@style/Widget.MaterialSheetFab.Sheet">

            <!-- Sheet items -->
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <!-- Recording -->
                <TextView
                    android:id="@+id/fab_sheet_item_recording"
                    style="@style/TextAppearance.MaterialSheetFab.Sheet.Item"
                    android:drawableLeft="@drawable/ic_mic_grey600_24dp"
                    android:drawableStart="@drawable/ic_mic_grey600_24dp"
                    android:text="@string/recording" />

                <!-- Reminder -->
                <TextView
                    android:id="@+id/fab_sheet_item_reminder"
                    style="@style/TextAppearance.MaterialSheetFab.Sheet.Item"
                    android:drawableLeft="@drawable/ic_access_alarms_grey600_24dp"
                    android:drawableStart="@drawable/ic_access_alarms_grey600_24dp"
                    android:text="@string/reminder" />

                <!-- Photo -->
                <TextView
                    android:id="@+id/fab_sheet_item_photo"
                    style="@style/TextAppearance.MaterialSheetFab.Sheet.Item"
                    android:drawableLeft="@drawable/ic_photo_camera_grey600_24dp"
                    android:drawableStart="@drawable/ic_photo_camera_grey600_24dp"
                    android:text="@string/photo" />

                <!-- Note -->
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/theme_accent">

                    <TextView
                        android:id="@+id/fab_sheet_item_note"
                        style="@style/TextAppearance.MaterialSheetFab.Sheet.Item"
                        android:drawableLeft="@drawable/ic_create_grey600_24dp"
                        android:drawableStart="@drawable/ic_create_grey600_24dp"
                        android:text="@string/createnote" />
                </LinearLayout>

            </LinearLayout>

        </android.support.v7.widget.CardView>

    </io.codetail.widget.RevealLinearLayout>

    <!-- Snackbar -->
    <LinearLayout
        android:id="@+id/snackbar"
        style="@style/Widget.MaterialSheetFab.Snackbar"
        android:layout_alignParentBottom="true">

        <TextView
            style="@style/TextAppearance.MaterialSheetFab.Snackbar.Message"
            android:text="@string/snackbar_shared_msg" />

        <TextView
            style="@style/TextAppearance.MaterialSheetFab.Snackbar.Action"
            android:text="@string/view" />
    </LinearLayout>
</RelativeLayout>

<!--<android.support.design.widget.NavigationView
    android:id="@+id/navigation_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    app:headerLayout="@layout/layout_drawer_header" />-->

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

Thanks for any help :)

Edit:

i imported library using build.gradle file.
(i didn't actually copied the library to studio)

The com.gordonwong.materialsheetfab.sample.Fab class needs to be implemented. Please see the readme for details on how to do that.

@gowong Thanks.
It solved my problem 💯

can you please address #18

It's not bug with library. I'm new to android.

when you have sometime please have a look into it :)

@roshu10 I'd be glad to help out with any questions or issues related to this library, but I think it'd be better for you to post on stackoverflow any questions you have about Android.

@gowong
I tried to implement onClick on notes using few questions from stackoverflow.
But couldn't find solution
I did some changes.
my question is also here (https://plus.google.com/u/0/110290076138677327721/posts/4z2gAM93f9T)

This is the only issue stopping me from using this amazing library