前言:dp/dip代表独立像素,dpi代表屏幕每英寸像素点的个数,px与dp的转换公式为: px = dp *(dpi / 160)
一、效果图
二、源代码
AnimationActivity:
package com.example.duoyi.clientaidl;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.CardView;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import com.example.duoyi.AnimationAdapter;
import java.util.ArrayList;
import java.util.List;
public class AnimationActivity extends AppCompatActivity {
private static final int MAX_COUNT = 100;
private static final String TAG = "AnimationActivity";
RecyclerView rv;
CardView cv;
ImageView image;
ObjectAnimator animator;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_animation);
rv = findViewById(R.id.itemRv);
cv = findViewById(R.id.expand);
image = findViewById(R.id.insect);
List list = new ArrayList<>();
for (int i = 0; i < MAX_COUNT; i++) {
list.add("世界很美好,队形走起" + i);
}
LinearLayoutManager manager = new LinearLayoutManager(this);
manager.setOrientation(RecyclerView.