-1

i need to Achieve something like this in android. i don't know how can i achieve this in android. i have already checked this but it is a full screen slider with images and all. i just need a simple text slider with several slides in the middle of the screen not full screen.

enter image description here

i have already done that in my iOS app but i am wondering if i can do that in android app also. please do let me know how can i do this. Any Tutorial or code snippet would be great help. Thanks

here is my code so far. in onCreate method:

//Set the pager with an adapter
        ViewPager pager = (ViewPager)findViewById(R.id.pager);
        List<Integer> objects = Arrays.asList(Color.BLUE, Color.GREEN, Color.RED);
        pager.setAdapter(new ViewPagerCustomAdapter(objects));
        //Bind the title indicator to the adapter
        ViewPagerWithIndicator viewPagerWithIndicator = (ViewPagerWithIndicator)findViewById(R.id.viewPagerWithIndicator);
        viewPagerWithIndicator.setViewPager(pager);

and xml

<com.kassisdion.library.ViewPagerWithIndicator
        app:arrow.enable="true"
        app:arrow.width="50dip"
        app:arrow.height="50dip"
        app:left_arrow.drawable="@drawable/ic_action_arrow_left"
        app:right_arrow.drawable="@drawable/ic_action_arrow_right"
        app:round.enable="true"
        app:round.size="15dip"
        app:round.drawable="@drawable/background_rounded"
        app:round.color.default="@android:color/white"
        app:round.color.selected="@android:color/holo_blue_light"
        android:id="@+id/viewPagerWithIndicator"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    </com.kassisdion.library.ViewPagerWithIndicator>
Vix Hunk
  • 303
  • 4
  • 17

1 Answers1

0

Use this demo.

You can put your view pager in center of activity with wrap_content and instead of ImageView you can put TextView with wrap_content . It's easy and no other library is need to implement.

Community
  • 1
  • 1
Giteeka Sawlani
  • 465
  • 2
  • 8