How to create a slideview cardview (similar to Nubank)? [closed]

0

I'm trying to make a layout similar to cardview of the main screen of nubank, however, I'm not able to find reference to base myself. What I'm having trouble finding, is like leaving cardview with these "dots". Can anyone point me some material, or even give me hints on how to do it?

    
asked by anonymous 10.11.2018 / 12:45

1 answer

1

I was able to do the following:

I've used ViewPager content SpringDotsIndicator . I created separate layout files for CardView , and inflated them to Fragment .

Add this implementation to Gradle:

implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:2.1.2'

Add this snippet to activity_main

<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp">

    <com.tbuonomo.viewpagerdotsindicator.SpringDotsIndicator
        android:id="@+id/dots_indicator"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:dotsColor="@color/white"
        app:dotsCornerRadius="8dp"
        app:dotsSize="10dp"
        app:dotsSpacing="4dp"
        app:dotsWidthFactor="2.5" />
</RelativeLayout>

Note: I added everything inside a LinearLayout .

In your MainActivity.java do not forget to add:

viewPager = findViewById(R.id.view_pager);
dotsIndicator = findViewById(R.id.dots_indicator);
viewPager.setAdapter(adapter);
dotsIndicator.setViewPager(viewPager);
    
24.11.2018 / 12:38