Error inflating class android.support.design.widget.TabLayout

Don’t know if this relates to your problem. I changed tags of TabLayout and ViewPager to ones that correspond to ones on this page: https://material.io/develop/android/components/tab-layout/ Here is my code from my app, which made errors go away: <com.google.android.material.tabs.TabLayout android:id=”@+id/sliding_tabs” android:layout_width=”match_parent” android:layout_height=”wrap_content” app:tabMode=”fixed”/> <androidx.viewpager.widget.ViewPager android:id=”@+id/viewpager” android:layout_width=”match_parent” android:layout_height=”0px” android:layout_weight=”1″ android:background=”@android:color/white” />

Android support v23.1.0 update breaks NavigationView get/find header

With the design library v 23.1.0 the NavigationView works with a RecyclerView. Also the Header is now a type of row. It means that the header could not be immediately available in the view hierarchy. It can cause issues if you are using methods like navigationView.findViewById(XXX) to get a view inside the header. There is … Read more

Rounded corners on material button

With the Material Components Library:. Add the dependency to your build.gradle: dependencies { implementation ‘com.google.android.material:material:1.3.0’ } In this case you can use a MaterialButton in your layout file: <com.google.android.material.button.MaterialButton …. style=”@style/Widget.MaterialComponents.Button” app:cornerRadius=”..” app:strokeColor=”@color/colorPrimary”/> Use app:cornerRadius attribute to change the size of corner radius. This will round off the corners with specified dimensions. You can also … Read more

Error inflating class CollapsingToolbarLayout

I found a solution May it work try it: add below code in gradle build file compile (‘com.android.support:support-v4:23.4.0′){ force = true; } Seems like it is having version conflict issue. All support library must be of same version. However, I didn’t use v4 support library before and it works. I don’t know why updatimg android … Read more

Set state of BottomSheetDialogFragment to expanded

“Note that you cannot call the method before view layouts.” The above text is the clue. Dialogs have a listener that is fired once the dialog is shown. The dialog cannot be shown if it isn’t laid out. So, in the onCreateDialog() of your modal bottom sheet (BottomSheetFragment), just before returning the dialog (or anywhere, … Read more

How to hide ToolBar when I scrolling content up?

you have to do many changes in your both layout. first use CoordinatorLayout in activity_main.XML like below(change theme as per your requirement). <?xml version=”1.0″ encoding=”utf-8″?> <android.support.design.widget.CoordinatorLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:id=”@+id/main_content” android:layout_width=”match_parent” android:layout_height=”match_parent” android:fitsSystemWindows=”true”> <android.support.design.widget.AppBarLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:theme=”@style/ThemeOverlay.AppCompat.Dark.ActionBar”> <android.support.v7.widget.Toolbar android:id=”@+id/toolbar” android:layout_width=”match_parent” android:layout_height=”?attr/actionBarSize” android:background=”?attr/colorPrimary” android:theme=”@style/ThemeOverlay.AppCompat.Dark.ActionBar” app:layout_scrollFlags=”scroll|enterAlways” app:popupTheme=”@style/ThemeOverlay.AppCompat.Light” /> </android.support.design.widget.AppBarLayout> <include layout=”@layout/content_main” /> </android.support.design.widget.CoordinatorLayout> in content_main.XML use android.support.v4.widget.NestedScrollView instead … Read more

InflateException with FloatingActionButton from Official Design Library

com.android.support:appcompat-v7:21+ added support for tinting widgets on devices running pre android 5.1 (API Level 21). To make use of it make sure you extend or set the AppCompat Theme and use app:backgroundTint instead of android:backgroundTint. Example: <android.support.design.widget.FloatingActionButton xmlns:app=”http://schemas.android.com/apk/res-auto” android:id=”@+id/fab” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_margin=”16dp” android:src=”https://stackoverflow.com/questions/30870443/@drawable/icon” app:backgroundTint=”@color/accent” app:borderWidth=”0dp” />

Disabling User dragging on BottomSheet

It can be now no longer relevant, but I will leave it here: import android.content.Context import android.util.AttributeSet import androidx.coordinatorlayout.widget.CoordinatorLayout import android.view.MotionEvent import android.view.View import com.google.android.material.bottomsheet.BottomSheetBehavior @Suppress(“unused”) class LockableBottomSheetBehavior<V : View> : BottomSheetBehavior<V> { constructor() : super() constructor(context: Context, attrs: AttributeSet) : super(context, attrs) var swipeEnabled = true override fun onInterceptTouchEvent( parent: CoordinatorLayout, child: V, event: … Read more