CardView Corner Radius

Unless you try to extend the Android CardView class, you cannot customize that attribute from XML. Nonetheless, there is a way of obtaining that effect. Place a CardView inside another CardView and apply a transparent background to your outer CardView and remove its corner radius (“cornerRadios = 0dp”). Your inner CardView will have a cornerRadius … Read more

Android CardView remove padding

UDPATE Well, seems there is a much easier way to do it, without guessing the padding and all: card_view:cardPreventCornerOverlap=”false” or using java: cardView.setPreventCornerOverlap(false) You can read all about it here. ORIGINAL ANSWER It is an intentional padding to avoid content from bleeding off the rounded corner of the card in pre lollipop versions (since clipping … Read more

How to implement setOnScrollListener in RecyclerView

Activity Class with recylcerview in xml layout file public class WallpaperActivity extends AppCompatActivity implements OnTaskCompleted { private static final String TAG = “WallpaperActivity”; private Toolbar toolbar; private RecyclerView mRecyclerView; private WallPaperDataAdapter mAdapter; private LinearLayoutManager mLayoutManager; // to keep track which pages loaded and next pages to load public static int pageNumber; private List<WallPaper> wallpaperImagesList; protected … Read more

CardView not showing Shadow in Android L

After going through the docs again, I finally found the solution. Just add card_view:cardUseCompatPadding=”true” to your CardView and shadows will appear on Lollipop devices. What happens is, the content area in a CardView take different sizes on pre-lollipop and lollipop devices. So in lollipop devices the shadow is actually covered by the card so its … Read more

Error inflating class and android.support.v7.widget.CardView

I guess I can answer my own question. Go to File -> Import -> Existing Android code into workspace –> Browse (Go to sdk/extras/android/support/v7/cardview) –> Click ok –> Click Finish Your project explorer will now show cardview as a project. Right click on cardview project –> Properties –> Android(Left Pane) –> Enable isLibrary (tick the … Read more

How to add Android Support v7 libraries in eclipse?

From: https://developer.android.com/tools/support-library/setup.html#libs-with-res I know this looks like a lot of steps, but in reality it’s just very broken down and only takes two minutes To add a Support Library with resources (such as v7 cardview) to your application project using Eclipse: Create a library project based on the support library code: Make sure you have … Read more

How to know when the RecyclerView has finished laying down the items?

I also needed to execute code after my recycler view finished inflating all elements. I tried checking in onBindViewHolder in my Adapter, if the position was the last, and then notified the observer. But at that point, the recycler view still was not fully populated. As RecyclerView implements ViewGroup, this anwser was very helpful. You … Read more

How do I get the position selected in a RecyclerView?

Set your onClickListeners on onBindViewHolder() and you can access the position from there. If you set them in your ViewHolder you won’t know what position was clicked unless you also pass the position into the ViewHolder EDIT As pskink pointed out ViewHolder has a getPosition() so the way you were originally doing it was correct. … Read more