I have this layout with coordinator layout, that has tabs with viewpager and in viewpager adapter I create recyclerview for each page.
Layout :
08-09 11:28:17.816 2804-2804/com.xxx.yyy.debug E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.IllegalArgumentException: width and height must be > 0
at android.graphics.Bitmap.createBitmap(Bitmap.java:638)
at android.graphics.Bitmap.createBitmap(Bitmap.java:620)
at android.support.design.widget.CollapsingTextHelper.ensureExpandedTexture(CollapsingTextHelper.java:413)
at android.support.design.widget.CollapsingTextHelper.setInterpolatedTextSize(CollapsingTextHelper.java:390)
at android.support.design.widget.CollapsingTextHelper.calculateOffsets(CollapsingTextHelper.java:227)
at android.support.design.widget.CollapsingTextHelper.setExpansionFraction(CollapsingTextHelper.java:203)
at android.support.design.widget.CollapsingToolbarLayout$OffsetUpdateListener.onOffsetChanged(CollapsingToolbarLayout.java:768)
at android.support.design.widget.AppBarLayout$Behavior.dispatchOffsetUpdates(AppBarLayout.java:853)
at android.support.design.widget.AppBarLayout$Behavior.setAppBarTopBottomOffset(AppBarLayout.java:836)
at android.support.design.widget.AppBarLayout$Behavior.scroll(AppBarLayout.java:795)
at android.support.design.widget.AppBarLayout$Behavior.onNestedPreScroll(AppBarLayout.java:635)
at android.support.design.widget.AppBarLayout$Behavior.onNestedPreScroll(AppBarLayout.java:583)
at android.support.design.widget.CoordinatorLayout.onNestedPreScroll(CoordinatorLayout.java:1477)
at android.support.v4.view.ViewParentCompat$ViewParentCompatStubImpl.onNestedPreScroll(ViewParentCompat.java:106)
at android.support.v4.view.ViewParentCompat.onNestedPreScroll(ViewParentCompat.java:355)
at android.support.v4.view.NestedScrollingChildHelper.dispatchNestedPreScroll(NestedScrollingChildHelper.java:208)
at android.support.v7.widget.RecyclerView.dispatchNestedPreScroll(RecyclerView.java:8376)
at android.support.v7.widget.RecyclerView.onTouchEvent(RecyclerView.java:2191)
at android.view.View.dispatchTouchEvent(View.java:7205)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2231)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1964)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2237)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1979)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2237)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1979)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2237)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1979)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2237)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1979)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2237)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1979)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2237)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1979)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2237)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1979)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2237)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1979)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2237)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1979)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2151)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1480)
at android.app.Activity.dispatchTouchEvent(Activity.java:2435)
at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:59)
at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:59)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2099)
at android.view.View.dispatchPointerEvent(View.java:7385)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3398
Here are the layouts :
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/turquoise_blue"
tools:context=".MainActivity">
<include
layout="@layout/profile_content" />
<include
layout="@layout/drawer_menu" />
</android.support.v4.widget.DrawerLayout>
and the profile content layout :
<?xml version="1.0" encoding="utf-8"?>
<ui.screen.ProfileView
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">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/profile_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
android:id="@+id/profile_appbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
app:elevation="2dp"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:expandedTitleTextAppearance="@android:color/transparent"
app:elevation="2dp">
<LinearLayout
android:id="@+id/profile_user_layout"
android:layout_width="match_parent"
android:layout_height="192dp"
android:background="?attr/colorPrimary"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical"
android:paddingBottom="24dp"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:paddingTop="64dp"
app:layout_collapseMode="parallax">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
android:orientation="horizontal">
<FrameLayout
android:layout_width="96dp"
android:layout_height="96dp"
android:clipChildren="false">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/profile_user_photo"
android:layout_width="86dp"
android:layout_height="86dp"
android:src="@mipmap/ic_launcher"
app:border_width="1dp"
app:border_color="@color/white"/>
<View
android:id="@+id/profile_user_medal"
android:layout_width="24dp"
android:layout_height="24dp"
android:background="@drawable/medal"
android:layout_marginRight="6dp"
android:layout_marginTop="2dp"
android:layout_gravity="top|right"/>
</FrameLayout>
<LinearLayout
android:id="@+id/profile_user_details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:layout_marginLeft="16dp">
<TextView
android:id="@+id/profile_user_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Kateřina Bíla"
android:textColor="@color/white"
android:textSize="24sp"/>
<TextView
android:id="@+id/profile_user_completed_activities"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Dokoncene 4 z 5"
android:textColor="@color/white"
android:textSize="16sp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/profile_user_progress_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textColor="@color/white"
android:text="50%"/>
<com.rey.material.widget.ProgressView
android:id="@+id/profile_user_progress_bar"
android:layout_width="match_parent"
android:layout_height="6dp"
android:visibility="visible"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:paddingRight="16dp"
app:pv_progressMode="determinate"
app:pv_circular="false"
app:pv_autostart="true"
app:lpd_strokeSize="3dp"
app:lpd_strokeColor="@color/red"
app:lpd_strokeSecondaryColor="@color/white"
app:lpd_maxLineWidth="62dp"
app:lpd_minLineWidth="31dp"
app:pv_progressStyle="@style/ProfileTotalProgressBar"
app:pv_progress="0.5"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<include
layout="@layout/toolbar" />
</android.support.design.widget.CollapsingToolbarLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="48dp">
<android.support.design.widget.TabLayout
android:id="@+id/profile_tab_layout"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_gravity="top"
android:background="?attr/colorPrimary"
app:tabTextColor="@color/white_87"
app:tabGravity="fill"
app:tabIndicatorColor="@color/white"
app:tabIndicatorHeight="4dp"
app:tabMode="fixed"
app:tabSelectedTextColor="@color/white"
app:tabTextAppearance="@style/TabTextAppearance"
/>
</FrameLayout>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
</ui.screen.ProfileView>
The thing is this only happens on Samsung S3 mini. I tried more devices like Nexus 5, Samsung Galaxy S6, some older HTC devices, but only on the mini I get this error while trying to scroll up with recyclerview. I don't get the bitmap error.
Edit: I made some more research, this problem seems to be affecting all devices on API lower than KitKat.
I had this issue today.
I finally managed to solve it. In my case it was because
i got textSize 0sp to make text invisible in expanded mode:
<style name="AdDetailExpandedTitleText" parent="@android:style/TextAppearance.Medium">
<item name="android:textColor">#FFFFFF</item>
<item name="android:textSize">0sp</item>
</style>
I set the textSize to something other than 0sp, instead set color #00000000 to make it transparent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With