【发布时间】:2017-03-12 12:40:48
【问题描述】:
我正在开发一个需要在 Android 设备上一直运行到 Android Gingerbread (2.3) 的应用程序,并且似乎在显示 SVG 图像时遇到了一些问题。
我了解,支持库允许我通过将这一行放在我的应用级别 build.gradle 中来使用矢量图像:
vectorDrawables.useSupportLibrary = true
然后我可以使用各种支持库类或android:srcCompat 在ImageView 中显示 SVG
这里的问题是我没有使用 ImageView 来显示我的 SVG。我正在使用带有android:drawableTop 属性的TextView 来显示我的SVG,如下所示:
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/text_no_notes"
android:textAlignment="center"
android:drawableTop="@drawable/ic_notepad"
android:id="@+id/textView"
android:textAppearance="@style/TextAppearance.AppCompat.Medium.Inverse" />
由于android:drawableTop 不使用支持库矢量图像,因此应用程序在运行时会在“L”之前的设备上崩溃。有什么解决方法可以让android:drawableTop 工作,还是我只是拆分TextView 并使用android:srcCompat?
【问题讨论】:
标签: android svg android-support-library vector-graphics