How to obtain the automatic change of the images with the fade animation?
public class MainActivity extends AppCompatActivity {
public void fade (View view) {
ImageView img1 = (ImageView) findViewById(R.id.img1);
ImageView img2 = (ImageView) findViewById(R.id.img2);
img1.animate().alpha(0f).setDuration(1000);
img2.animate().alpha(1f).setDuration(1000);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT > 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
setContentView(R.layout.activity_main);
}
}
Comments
Post a Comment