Record the learning and use of carousel pictures in Android for your reference. The specific content is as follows
1. Add dependencies in (:app) file
implementation ':rollviewpager:1.2.9'
2、activity_main.xml
< android: android:layout_width="match_parent" android:layout_height="180dp" app:rollviewpager_play_delay="3000" />
3、
import ; import ; import ; import ; import ; import ; import ; import ; import ; public class MainActivity extends AppCompatActivity { private RollPagerView mRollPagerView; @Override protected void onCreate(Bundle savedInstanceState) { (savedInstanceState); setContentView(.activity_main); mRollPagerView=findViewById(.roll_view_pager); //Set playback time interval (3000); //Set transparency (500); //Set the adapter (new TestNormalAdapter()); //Set the dot indicator color (new ColorPointHintView(this, ,)); } //Custom adapter private class TestNormalAdapter extends StaticPagerAdapter{ //Photoes required for carousel private int[] imgs={ , .daxuesheng2, }; @Override public View getView(ViewGroup container, int position) { ImageView view=new ImageView(()); (imgs[position]); (.CENTER_CROP); (new (.MATCH_PARENT,.MATCH_PARENT)); return view; } @Override public int getCount() { return ; } }; }
The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.