Skip to content Skip to sidebar Skip to footer

Runtimeexception: Could Not Inflate Behavior Subclass

I new in android and I've troubles with FloatingActionButton behaivors My custom behavoir class: public class ScrollingFABBehavior extends FloatingActionButton.Behavior { priva

Solution 1:

Add the following two constructors to your FooterBehavior:

public FooterBehavior() {
}

public FooterBehavior(Context context, AttributeSet attrs) {
    super(context, attrs);
}

Solution 2:

Make sure that you are using the absolute path instead of a relative path of the custom behavior class.

For example:

app:layout_behavior="net.company.myapp.view.behavior.TextViewBehavior"

Solution 3:

If you are using AndroidX (open-source project that the Android team uses to develop, test, package, version and release libraries within Jetpack) then you need to update XML.

Find your element here and replace:

Support:

android.support.design.widget.FloatingActionButton

AndroidX:

com.google.android.material.floatingactionbutton.FloatingActionButton

Solution 4:

If you are using BottomSheet in Android X you must use

app:layout_behavior="@string/bottom_sheet_behavior"

if not then use

app:layout_behavior="android.support.design.widget.BottomSheetBehavior"

Solution 5:

In case your app has a different package ID than your actual package structure, make sure you specify the full path to your custom behavior class:

<android.support.design.widget.FloatingActionButton...app:layout_behavior="com.example.xyzreader.ScrollingFABBehavior"/>

Post a Comment for "Runtimeexception: Could Not Inflate Behavior Subclass"