-
Notifications
You must be signed in to change notification settings - Fork 3
/
slide.java
39 lines (34 loc) · 1.2 KB
/
slide.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package change.com.animationwithsplash;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.ViewFlipper;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;
public class slide extends AppCompatActivity {
ViewFlipper v_flipper;
int[] images ={
R.drawable.slider1,
R.drawable.slider2,
R.drawable.slider3,
R.drawable.slider4
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_slide);
v_flipper = findViewById(R.id.v_flipper);
for (int i = 0 ; i < images.length ; i++)
{
flip_images(images[i]);
}
}
private void flip_images(int image) {
ImageView view = new ImageView(this);
view.setBackgroundResource(image);
v_flipper.addView(view);
v_flipper.setFlipInterval(2000);
v_flipper.setAutoStart(true);
v_flipper.setInAnimation(this,android.R.anim.slide_in_left);
v_flipper.setOutAnimation(this,android.R.anim.slide_out_right);
}
}