Code Slide show Banner Toko Online

//Buat Variabel String dengan nama img1, img2, img3, img4.

//Buat 4 Page Baru Dengan Nama page1, page2, page3, page4

//Masukan imageview1 dimasing masing page

//Contoh link img

https://manysolutions.com/media/deals/deal/1520951988big30.1536563451.jpg

https://manysolutions.com/media/deals/deal/1520951858Blog_Banner.1536563451.jpg

https://manysolutions.com/media/deals/deal/many-solutions-1562585627manysolutions-remarkable-tablet.jpg

https://manysolutions.com/media/deals/deal/many-solutions-1554980423airlock.jpg

//Buat moreblock dan masukan kode berikut :

//Code1

View v1 = (View) getLayoutInflater().inflate(R.layout.page1, null);

final ImageView image1 = (ImageView) v1.findViewById(R.id.imageview1);

Glide.with(getApplicationContext()).load(Uri.parse(img1)).into(image1);

//Code2

View v2 = (View) getLayoutInflater().inflate(R.layout.page2, null);

final ImageView image2 = (ImageView) v2.findViewById(R.id.imageview1);

Glide.with(getApplicationContext()).load(Uri.parse(img2)).into(image2);

//Code3

View v3 = (View) getLayoutInflater().inflate(R.layout.page3, null);

final ImageView image3 = (ImageView) v3.findViewById(R.id.imageview1);

Glide.with(getApplicationContext()).load(Uri.parse(img3)).into(image3);

//Code4

View v4 = (View) getLayoutInflater().inflate(R.layout.page4, null);

final ImageView image4 = (ImageView) v4.findViewById(R.id.imageview1);

Glide.with(getApplicationContext()).load(Uri.parse(img4)).into(image4);

//Code5

ViewGroup.LayoutParams lp =new ViewGroup.LayoutParams(getDisplayWidthPixels(), LinearLayout.LayoutParams.WRAP_CONTENT);

//Code6

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);

//Code7

vfl.setAutoStart(true);
linear1.addView(vfl);

//Code8

}

//Code9

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;
}

//Code10

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

  1. kira" brapa gan biayanya bisa ndak bantu

    ReplyDelete
  2. Gan ko eror mulu kalau code no 10 di pasang..tapj kalau gk di pasang bisa di install gimana si..gan ?

    ReplyDelete
  3. Maaf bg. kalo misalnya saya gda buat opsi separate admin user itu, posisi more blocknya diletak dimana?
    apa bisa lgsg dibawah on activity create?

    ReplyDelete
  4. Code d project ane jg eror

    ReplyDelete
  5. Bang saya juga kok error ya ps di code yg ke 1 - 4.. kok "Glide.with(getApplicationContext()).load(Uri.parse(img4)).into(image4); cannot resolve" gitu mulu

    ReplyDelete
  6. Mas Eror Disini kenapa ya ???
    Mohon bantuannya mas ..

    1. ERROR in /storage/emulated/0/.sketchware/
    mysc/601/app/src/main/java/com/monitoring/kerja/
    MainActivity.java (at line 162)
    Syntax error on token ", delete this token
    1 problem (1 error)

    ReplyDelete

Post a Comment

Popular posts from this blog

Code Enable Download & Upload

Perfact Login With Verification Email

Navigator Online Shop