在夸大MaterialAnimatedSwitch时出错

时间:2017-11-25 08:44:18

标签: java android android-layout android-view android-switch

我正在构建一个应用程序,其中我使用了glomadrain的动画切换按钮。 当我完成编码后,我得到了以下错误:

  

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)引起:java.lang.NullPointerException:尝试调用虚拟   null对象上的方法'int android.graphics.Bitmap.getWidth()'   在android.graphics.Bitmap.createScaledBitmap(Bitmap.java:750)的引用   com.github.glomadrian.materialanimatedswitch.painter.IconPainter.initBitmap(IconPainter.java:41)                                                                                     在   com.github.glomadrian.materialanimatedswitch.painter.IconPainter.init(IconPainter.java:36)                                                                                     在   com.github.glomadrian.materialanimatedswitch.painter.IconPainter。(IconPainter.java:30)   11-25 14:05:04.032 4625-4625 / com.example.surajnath.taproute   E / AndroidRuntime:at   com.github.glomadrian.materialanimatedswitch.painter.IconPressPainter。(IconPressPainter.java:30)                                                                                     在   com.github.glomadrian.materialanimatedswitch.MaterialAnimatedSwitch.initPainters(MaterialAnimatedSwitch.java:79)                                                                                     在   com.github.glomadrian.materialanimatedswitch.MaterialAnimatedSwitch.init(MaterialAnimatedSwitch.java:65)                                                                                     在   com.github.glomadrian.materialanimatedswitch.MaterialAnimatedSwitch.init(MaterialAnimatedSwitch.java:90)                                                                                     在   com.github.glomadrian.materialanimatedswitch.MaterialAnimatedSwitch。(MaterialAnimatedSwitch.java:54)

这里是关于地图和开关的代码:

<com.github.glomadrian.materialanimatedswitch.MaterialAnimatedSwitch
    android:layout_width="0dp"
    android:layout_weight="3"
    android:id="@+id/location_switch"
    android:layout_height="wrap_content"
    app:icon_release="@drawable/ic_location_off_black_24dp"
    app:icon_press="@drawable/ic_location_on_black_24dp"
    app:base_release_color="@color/baseReleaseColor"
    app:base_press_color="@color/basePressColor"
    app:ball_release_color="@color/ballReleaseColor"
    app:ball_press_color="@android:color/white"/>

1 个答案:

答案 0 :(得分:1)

问题是,您使用矢量drawable作为WITH cte1 AS ( SELECT DocNo, [Sheet No], MAX(CASE WHEN [lineNo] LIKE ' %' THEN id_Doc_line_sheet END) AS id_old, MAX(CASE WHEN [lineNo] NOT LIKE ' %' THEN id_Doc_line_sheet END) AS id_new FROM table1 GROUP BY DocNo, [Sheet No] HAVING SUM(CASE WHEN [lineNo] LIKE ' %' THEN 1 ELSE 0 END) > 0 ), cte2 AS ( SELECT t1.id_Doc_line_trans, t1.id_Doc_line_sheet, t1.name, t2.id_old, t2.id_new FROM table2 t1 INNER JOIN cte1 t2 ON t1.id_Doc_line_sheet = t2.id_old ) UPDATE cte2 SET id_Doc_line_sheet = id_new; app:icon_press的输入,而库不支持矢量drawable。

您必须在创建app:icon_release时分叉库并执行necessary changes,或者您可以提供非向量drawable作为这些参数的输入。