伙计,我遇到的错误在发生时没有模式。到目前为止,我有证据表明这仅发生在android 9上。
问题是,我的某些矢量图标没有显示,但是我提到的方式有时会发生。
这是同一部智能手机的两个屏幕截图,其中一个带有图标,另一个没有。
这是我的图标XML之一:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="21dp"
android:viewportWidth="20.0"
android:viewportHeight="21.481">
<path
android:pathData="M16.815,21.481H3.185A3.162,3.162 0,0 1,0 18.3V3.185A3.162,3.162 0,0 1,3.185 0H16.741A3.179,3.179 0,0 1,20 3.185V18.222A3.179,3.179 0,0 1,16.815 21.481Z"
android:fillColor="@color/colorPrimaryDark"/>
<path
android:pathData="M9.926,5.63a4.647,4.647 0,0 0,-2.593 0.667,2.021 2.021,0 0,0 -0.889,2h2.37a0.987,0.987 0,0 1,0.3 -0.741,1.493 1.493,0 0,1 0.815,-0.222 1.181,1.181 0,0 1,0.889 0.3,1.012 1.012,0 0,1 0.3,0.815 1.181,1.181 0,0 1,-0.3 0.889,3.184 3.184,0 0,1 -0.741,0.667 4.894,4.894 0,0 0,-1.259 1.037,2.047 2.047,0 0,0 -0.37,1.333h2.37a2.287,2.287 0,0 1,0.148 -0.815c0.074,-0.222 0.3,-0.37 0.593,-0.593A3.107,3.107 0,0 0,12.889 9.93a2.078,2.078 0,0 0,0.519 -1.407,2.389 2.389,0 0,0 -0.963,-2A2.922,2.922 0,0 0,9.926 5.63"
android:fillColor="@color/white"/>
<path
android:pathData="M8.518,13.482h2.37v2.37h-2.37z"
android:fillColor="@color/white"/>
最后,是我的RecyclerView项目的布局文件:
<android.support.constraint.ConstraintLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center_vertical"
xmlns:tools="http://schemas.android.com/tools">
<ImageView
android:id="@+id/iv_hamburguer_icon"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:scaleType="centerInside"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:gravity="center_vertical"
android:id="@+id/tv_hamburguer_item_text"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
style="@style/AppTheme.DescriptionText.Primary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/tv_hamburguer_count"
app:layout_constraintHorizontal_bias="0.05"
app:layout_constraintStart_toEndOf="@+id/iv_hamburguer_icon"
app:layout_constraintTop_toTopOf="parent"
tools:text="Linha do tempo" />
<TextView
android:id="@+id/tv_hamburguer_count"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="40dp"
android:layout_marginTop="8dp"
android:background="@drawable/shape_bg_circle_secondary"
android:gravity="center"
style="@style/AppTheme.TextWhite"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="12" />
有什么想法如何继续弄清楚发生了什么事吗?