As I write blog for the first time, write bad please point out, thank you.

I have read an article about Rotate3dAnimation before. Then I wrote a 3D polling effect by hand and put it into the project with good performance. Please share it with your friends! Look directly at the effect, very simple to use. I’m having a problem recording this GIF, the end to end connection problem.

Need to introduce one of my home page depend on the package implementation ‘com. Gitee. Duanpingwei1: Mylibs: 1.1.1’

Then add a relative layout to the layout file


1<RelativeLayout

2    android:layout_centerInParent="true"

3    android:id="@+id/sand_Layout"

4    android:layout_width="202dp"

5    android:layout_height="273dp"/>


Copy the code

Main code

public class MainActivity extends AppCompatActivity {

private RelativeLayout sand_Layout;

private ArrayList<String> integers;

String icon1 = "* * *";// Change the address by yourself

String icon2 = "* * *";

String icon3 = "* * *";

MyAnimation myAnimation;



@Override

protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    sand_Layout =findViewById(R.id.sand_Layout);

    integers = new ArrayList<>();

    integers.add(icon1);

    integers.add(icon2);

    integers.add(icon3);

   // The first parameter is our relative layout and the second is the rotation interval

    myAnimation =new MyAnimation(sand_Layout,2000);

    //1 and 0 represent horizontal and vertical flip respectively

    myAnimation.addReLayout(MainActivity.this,integers,1.0);

    myAnimation.setOnImgClickListener(new MyAnimation.OnImgClickListener() {

        @Override

        public void onClick(int position, View view) {



        }

    });



}



@Override

protected void onDestroy(a) {

    super.onDestroy();

    myAnimation.cancelRotate();

}

Copy the code

}


Pay special attention to is to open Internet access and the introduction of glide I is the implementation of ‘com. Making. Bumptech. Glide: glide: 4.8.0’ will no longer display or pictures