Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.TEST.TEST, PID: 27236
android.view.InflateException: Binary XML file line #26: Binary XML file line #26: Error inflating class com.google.android.material.appbar.CollapsingToolbarLayout
Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class com.google.android.material.appbar.CollapsingToolbarLayout
enter code here
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.material.appbar.CollapsingToolbarLayout"
here is xml I use:
<?xml version="1.0" encoding="utf-8"?>
<ProgressBar
android:id="@+id/progressTickets"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true" />
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="250dp"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="10dp"
app:expandedTitleMarginTop="10dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<LinearLayout
android:id="@+id/llBuyTickets"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/montserrat_bold"
android:text="@string/buy_ticket"
android:textColor="@color/colorDarkGreen"
android:textSize="9pt" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="@font/roboto_regular"
android:text="@string/buy_ticket_description"
android:textColor="@color/colorDarkGreen" />
<HorizontalScrollView
android:id="@+id/svTicketTypes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/content_padding_medium"
android:layout_marginTop="@dimen/content_padding_medium"
android:scrollbars="none">
<LinearLayout
android:id="@+id/llTicketTypes"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal" />
</HorizontalScrollView>
<Button
android:id="@+id/btnBuyTicket"
style="@style/AlertDialog.AppCompat.Light"
android:layout_width="match_parent"
android:layout_height="@dimen/view_auth_item_size"
android:background="@drawable/view_rounded_accent_bg"
android:enabled="false"
android:fontFamily="@font/montserrat_bold"
android:text="@string/confirm_purchase"
android:textColor="@color/white" />
</LinearLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/AppBar"
android:layout_width="match_parent"
android:layout_height="10dp"
app:layout_collapseMode="pin" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="@font/montserrat_bold"
android:text="@string/my_ticket"
android:textColor="@color/colorDarkGreen"
android:textSize="9pt" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rvTickets"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
–
–
Use android.support.design
instead of android.support.design.widget
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:contentScrim="?attr/colorPrimary"/>
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.