Slide_baner_sketchware
1.
View v1 = (View) getLayoutInflater().inflate(R.layout.banner1, null);
final ImageView image1 = (ImageView) v1.findViewById(R.id.imageview1);
Glide.with(getApplicationContext()).load(Uri.parse(img1)).into(image1);
2.
View v2 = (View) getLayoutInflater().inflate(R.layout.banner2, null);
final ImageView image2 = (ImageView) v2.findViewById(R.id.imageview1);
Glide.with(getApplicationContext()).load(Uri.parse(img2)).into(image2);
3.
View v3 = (View) getLayoutInflater().inflate(R.layout.banner3, null);
final ImageView image3 = (ImageView) v3.findViewById(R.id.imageview1);
Glide.with(getApplicationContext()).load(Uri.parse(img3)).into(image3);
4.
View v4 = (View) getLayoutInflater().inflate(R.layout.banner4, null);
final ImageView image4 = (ImageView) v4.findViewById(R.id.imageview1);
Glide.with(getApplicationContext()).load(Uri.parse(img4)).into(image4);
5.
ViewGroup.LayoutParams lp =new ViewGroup.LayoutParams(getDisplayWidthPixels(), LinearLayout.LayoutParams.WRAP_CONTENT);
6.
ViewFlipper vfl = new ViewFlipper(this);
vfl.addView(v1, 0, lp);
vfl.addView(v2, 1, lp);
vfl.addView(v3, 2, lp);
vfl.addView(v4, 3, lp);
7.
vfl.setAutoStart(true);
linear1.addView(vfl);
8.
}
9.
public static Animation inFromRight(long ms){
Animation right = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f,Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f);
right.setDuration(ms);
return right;
}
10.
public static Animation outToLeft(long ms){
Animation left = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f,Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f);
left.setDuration(ms);
return left;
Comments
Post a Comment