Using 0.7.2
.
I have (in a DrawerLayout, though I don't think it matters) a carbon.widget.FrameLayout
that I'm using as a container for FragmentTransaction
s. I do this in my activity:
getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack()
.replace(R.id.content, fragment)
.commit();
Here's my layout:
<carbon.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/*removed*"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
android:fitsSystemWindows="true">
<carbon.widget.FrameLayout
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<carbon.widget.ScrimInsetsLayout
android:id="@+id/*removed*"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white"
android:fitsSystemWindows="true"
app:carbon_elevation="4dp"
app:carbon_insetForeground="#4000">
<fragment
android:id="@+id/fragment_drawer"
android:name="*removed*.DrawerFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/wallet_drawer" />
</carbon.widget.ScrimInsetsLayout>
</carbon.widget.DrawerLayout>
The first fragment transaction works fine. However, a subsequent one gives the following crash:
java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3195)
at carbon.widget.FrameLayout.dispatchDraw(FrameLayout.java:100)
at android.view.View.draw(View.java:15117)
at android.widget.FrameLayout.draw(FrameLayout.java:592)
at carbon.widget.FrameLayout.draw(FrameLayout.java:236)
at android.view.View.updateDisplayListIfDirty(View.java:14048)
at android.view.View.getDisplayList(View.java:14071)
at android.view.View.draw(View.java:14838)
at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
at android.support.v4.widget.DrawerLayout.drawChild(DrawerLayout.java:1086)
at carbon.widget.DrawerLayout.drawChild(DrawerLayout.java:168)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
at carbon.widget.DrawerLayout.dispatchDraw(DrawerLayout.java:99)
at android.view.View.draw(View.java:15117)
at carbon.widget.DrawerLayout.draw(DrawerLayout.java:235)
at android.view.View.updateDisplayListIfDirty(View.java:14048)
at android.view.View.getDisplayList(View.java:14071)
at android.view.View.draw(View.java:14838)
at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
at android.view.View.updateDisplayListIfDirty(View.java:14043)
at android.view.View.getDisplayList(View.java:14071)
at android.view.View.draw(View.java:14838)
at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
at android.view.View.updateDisplayListIfDirty(View.java:14043)
at android.view.View.getDisplayList(View.java:14071)
at android.view.View.draw(View.java:14838)
at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
at android.view.View.updateDisplayListIfDirty(View.java:14043)
at android.view.View.getDisplayList(View.java:14071)
at android.view.View.draw(View.java:14838)
at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
at android.view.View.updateDisplayListIfDirty(View.java:14043)
at android.view.View.getDisplayList(View.java:14071)
at android.view.View.draw(View.java:14838)
at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
at android.view.View.draw(View.java:15117)
at android.widget.FrameLayout.draw(FrameLayout.java:592)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2595)
at android.view.View.updateDisplayListIfDirty(View.java:14048)
at android.view.View.getDisplayList(View.java:14071)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:266)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:272)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:311)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2492)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2337)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1968)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:550)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Simply changing the carbon.widget.FrameLayout
to a regular Android FrameLayout
, with no other changes, fixes the issue.
My guess is it's something to do with the z-ordering Carbon does, but I'm not sure.
This isn't catastrophic for my case as using a regular FrameLayout is fine, but it could impede the use of shadows in some other cases.
bug