我想创建一个小的动画微调器然后我的图片正在加载。但是出了点问题,或者我可能是瞎子,不明白我应该改变什么。第一个问题是当占位符“加载”时 ViewHolder 很大。
第二个问题是微调器不旋转。如果有人能告诉我我错在哪里,我会很高兴。
XML:
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="720">
<shape
android:shape="ring"
android:thickness="2dp"
android:useLevel="false">
<gradient
android:angle="0"
android:endColor="@color/cesar_blue_69cff7"
android:startColor="@android:color/transparent"
android:type="sweep"
android:useLevel="false" />
</shape>
</rotate>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxHeight="50dp"
android:layout_marginTop="10dp"
app:cardCornerRadius="10dp"
app:cardElevation="2dp">
<ImageView
android:id="@+id/storeItemImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitXY"
tools:src="@drawable/enter_2_car" />
<TextView
android:id="@+id/storeItemText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:textColor="@color/white"
android:textStyle="bold"
android:textSize="12sp"
tools:text="someText" />
</androidx.cardview.widget.CardView>
Run Code Online (Sandbox Code Playgroud)
爪哇:
with(containerView) {
GlideApp.with(containerView)
.load("https://i.picsum.photos/id/688/5000/5000.jpg")
.override(290, 78)
.centerCrop()
.placeholder(R.drawable.progress_circle)
.into(storeItemImage)
}
Run Code Online (Sandbox Code Playgroud)
图片:
