Android使用共享元素实现转场动画 错误:Unable to create layer for LinearLayout

最近重构app商品模块,各种app借鉴,发现共享元素的效果挺不错,准备加上。

网上找资料,效果挺不错。然后就开始埋头重构。

先说一下商品界面的布局

使用SlideDetailsLayout 来实现界面上不的详情页和下部的webview图文说明页(产品说的照着京东来。。。)

        <com.zhtx.cs.customview.SlideDetailsLayout
            android:id="@+id/sv_switch"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <com.zhtx.cs.customview.MyScrollView
                android:id="@+id/sv_goods_info"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:scrollbars="none">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/c_eeeeee"
                    android:orientation="vertical"
                    >

                    // 要共享的view在这里
                    ...

                    <LinearLayout
                        android:id="@+id/ll_goods_detail_tuijian"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                        android:background="@color/white_true"
                        android:layout_marginTop="@dimen/x9"
                        android:visibility="visible">

                        <View style="@style/line" />

                        <com.bigkoo.convenientbanner.ConvenientBanner
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:background="#ffffff"
                            app:canLoop="true"
                            android:layout_marginLeft="15dp"
                            android:layout_marginRight="15dp"
                            android:layout_marginTop="15dp"
                            android:visibility="visible"/>

                    </LinearLayout>
                    ...

                 </LinearLayout>

            </com.zhtx.cs.customview.MyScrollView>

            <include layout="@layout/include_item_tab" />
        </com.zhtx.cs.customview.SlideDetailsLayout>

ScrollView里边各种乱七八糟的信息,我留下了ConvenientBanner,问题就出现在这里。

在使用转场动画的时候,在小米4手机上华丽丽的卡死了

报的错误是这样的

JNI DETECTED ERROR IN APPLICATION: JNI CallObjectMethod called with pending exception 
java.lang.IllegalStateException: Unable to create layer for LinearLayout'

说是不可以创建ConvenientBanner这个布局

然后网上各种找资料,网上说在共享元素实现转场动画,Transition group 设置为true,让我们可以将ViewGroup作为一个整体来变换

最后的解决方案是,在最外边的ScrollView加上这一句话

android:transitionGroup="true"

具体的原因大家有兴趣的可以看看 http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0116/2320.html






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值