Good day.

Perform the task: 1) In the card, display the result for the nth post (it should be possible to enter n into the card and click "Confirm" to display the result). If I correctly understood that the card (CardView) is a widge \ container, which is often used together RecyclerView (List)? How should the CardView logic work?

For example: I have several CardView in the app in the form of squares. In one of them there will be a field for input and a button to confirm. I enter there n click the "Confirm" button and throws me at another activation? Or should the information be displayed inside the card?

2) The second card users - display the result of the first 5 users in a single card (in 5 lines). What does “in a single card” mean and how should it work?

  • CardView is just a FrameLayout container with a “business card” background, no magic can be expected from it - pavlofff
  • it is not necessary to switch to another activity - Cypher

1 answer 1

If you mean CardView, then this is just a view, this is the same layer as FrameLayout (the FrameLayout is its parent)

You need to add it to build.gradle (Module: app), for starters:

dependencies { ... compile 'com.android.support:cardview-v7:26.0.2' } 

The layout is created like this:

 <android.support.v7.widget.CardView android:layout_width="wrap_content" android:layout_height="wrap_content"></android.support.v7.widget.CardView> 

Many important properties are set via the app:

 <android.support.v7.widget.CardView android:layout_width="wrap_content" android:layout_height="wrap_content" app:cardCornerRadius="8dp"> </android.support.v7.widget.CardView> 

For example, app:cardCornerRadius sets the rounding of the card.

Treat it like a layer on a layout. Other views must be put into it so that it displays something.

The official article should help:

https://developer.android.com/training/material/lists-cards.html?hl=en