alireza alireza - 2 months ago 8
Android Question

Vector icon not show on Lollipop and above

I have design a colored vector icon that use in my app.
Why that icon showed on pre lollipop version but not on above? Look:
enter image description here

This is my custom vector icon designed in inkscape:

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="19.6"
android:viewportHeight="19.2"
android:width="24.5dp"
android:height="24dp">
<group
android:scaleX="0.04242505"
android:scaleY="0.04242505"
android:translateX="-7.118632"
android:translateY="-3.364909">
<path
android:pathData="M230.3 140.13c1.03 -14.3 14.4 -26.3 28.6 -26.74 94.04 0 188.09 -0.01 282.13 0.01 14.64 0.75 28.57 13.6 28.64 28.59 -2.64 -13.86 -15.41 -25.41 -29.7 -25.54 -93.32 0.09 -186.63 0.04 -279.95 0.08 -13.87 -0.06 -25.94 10.61 -29.72 23.6z"
android:fillColor="#37a6dd" />
<path
android:pathData="M197.33 175.95c-0.03 -16.86 15.49 -31.57 32.29 -30.93 113.53 -0.04 227.07 -0.03 340.6 0 16.89 -0.79 32.45 14.02 32.46 30.92 0.02 93.02 0.01 186.05 0.01 279.07 0.18 11.71 -6.79 23.16 -17.27 28.39 -4.71 2.56 -10.11 3.61 -15.44 3.46 -110.66 -0.06 -221.32 0.01 -331.99 -0.04 -7.15 -0.05 -14.66 0.73 -21.34 -2.44 -11.55 -4.8 -19.6 -16.9 -19.33 -29.44 -0.01 -93 -0.03 -186 0.01 -278.99m281.78 39.82c-8.16 2.55 -15.44 8.09 -19.7 15.54 -4.7 7.82 -6 17.47 -3.91 26.31 -0.04 1.65 -0.33 3.35 0.05 4.98 3.07 10.48 10.99 19.55 21.26 23.46 6.73 2.28 14.1 3.5 21.06 1.44 12.36 -2.47 22.86 -12.22 26.09 -24.42 1.52 -5.87 2.73 -12.37 0.26 -18.16 -1.19 -8.53 -5.35 -16.65 -11.95 -22.24 -8.88 -7.83 -21.9 -10.46 -33.16 -6.91m-118.14 46.9c-6.2 1.67 -11.71 5.68 -15.23 11.06 -30.6 45.42 -61.19 90.85 -91.79 136.28 -1.58 2.28 -2.72 5.14 -2.03 7.94 0.72 4.71 5.34 8.29 10.1 7.81 76.96 -0.12 153.93 0.23 230.9 0.01 15.37 -0.18 30.76 0.18 46.13 -0.02 7.03 -0.12 11.32 -9.32 7.12 -14.9 -20.51 -30.51 -41.07 -60.99 -61.61 -91.49 -2.19 -3.39 -5.07 -6.37 -8.59 -8.39 -9.92 -6.07 -23.93 -4.38 -31.89 4.19 -4.95 5.79 -8.56 12.57 -13.02 18.72 -11.97 -18.28 -24.39 -36.27 -36.52 -54.46 -2.72 -3.87 -5.05 -8.14 -8.71 -11.23 -6.68 -5.83 -16.34 -7.91 -24.86 -5.52z"
android:fillColor="#37a6dd" />
</group>
<group
android:scaleX="0.04242505"
android:scaleY="0.04242505"
android:translateX="-7.118632"
android:translateY="-3.364909">
<path
android:pathData="M230.3 140.13c3.78 -12.99 15.85 -23.66 29.72 -23.6 93.32 -0.04 186.63 0.01 279.95 -0.08 14.29 0.13 27.06 11.68 29.7 25.54 0.14 0.76 0.41 2.27 0.55 3.03 -113.53 -0.03 -227.07 -0.04 -340.6 0 0.15 -1.64 0.31 -3.28 0.68 -4.89z"
android:fillColor="#1078bc" />
<path
android:pathData="M524.22 244.92c2.47 5.79 1.26 12.29 -0.26 18.16 -3.23 12.2 -13.73 21.95 -26.09 24.42 -6.96 2.06 -14.33 0.84 -21.06 -1.44 -10.27 -3.91 -18.19 -12.98 -21.26 -23.46 -0.38 -1.63 -0.09 -3.33 -0.05 -4.98 2.47 9.95 9.48 18.66 18.75 23.05 12.1 5.89 27.51 4.07 37.73 -4.75 9.02 -7.38 13.6 -19.47 12.24 -31z"
android:fillColor="#1078bc" />
</group>
<group
android:scaleX="0.04242505"
android:scaleY="0.04242505"
android:translateX="-7.118632"
android:translateY="-3.364909">
<path
android:pathData="M479.11 215.77c11.26 -3.55 24.28 -0.92 33.16 6.91 6.6 5.59 10.76 13.71 11.95 22.24 1.36 11.53 -3.22 23.62 -12.24 31 -10.22 8.82 -25.63 10.64 -37.73 4.75 -9.27 -4.39 -16.28 -13.1 -18.75 -23.05 -2.09 -8.84 -0.79 -18.49 3.91 -26.31 4.26 -7.45 11.54 -12.99 19.7 -15.54z"
android:fillColor="#faef58" />
</group>
<group
android:scaleX="0.04242505"
android:scaleY="0.04242505"
android:translateX="-7.118632"
android:translateY="-3.364909">
<path
android:pathData="M360.97 262.67c8.52 -2.39 18.18 -0.31 24.86 5.52 3.66 3.09 5.99 7.36 8.71 11.23 12.13 18.19 24.55 36.18 36.52 54.46 20.46 30.74 41.12 61.34 61.86 91.89 -76.97 0.22 -153.94 -0.13 -230.9 -0.01 -4.76 0.48 -9.38 -3.1 -10.1 -7.81 -0.69 -2.8 0.45 -5.66 2.03 -7.94 30.6 -45.43 61.19 -90.86 91.79 -136.28 3.52 -5.38 9.03 -9.39 15.23 -11.06z"
android:fillColor="#ffffff" />
</group>
<group
android:scaleX="0.04242505"
android:scaleY="0.04242505"
android:translateX="-7.118632"
android:translateY="-3.364909">
<path
android:pathData="M444.08 315.16c7.96 -8.57 21.97 -10.26 31.89 -4.19 3.52 2.02 6.4 5 8.59 8.39 20.54 30.5 41.1 60.98 61.61 91.49 4.2 5.58 -0.09 14.78 -7.12 14.9 -15.37 0.2 -30.76 -0.16 -46.13 0.02 -20.74 -30.55 -41.4 -61.15 -61.86 -91.89 4.46 -6.15 8.07 -12.93 13.02 -18.72z"
android:fillColor="#ccd6db" />
</group>
</vector>


and also this is my object:

<android.support.v7.widget.AppCompatImageButton
android:id="@+id/reveal_gallery"
android:background="@drawable/button_circle"
android:layout_width="58dp"
android:layout_height="58dp"
android:padding="12dp"
android:src="@drawable/ic_gallerry"
android:scaleType="fitXY"
/>


any one help me?
thank you.

Answer

Try using ImageButton instead of android.support.v7.widget.AppCompatImageButton and I hope it should work fine with Lollipop and above.

Comments