Pull to refresh recyclerview android

You can use android SwipeRefreshLayout widget instead of ProgressDialog. Follow below steps to integrate SwipeRefreshLayout in your Tab1history fragment: 1. In your layout tab1history, add SwipeRefreshLayout as a root layout and place RecyclewrView inside it. // tab1history.xml <?xml version=”1.0″ encoding=”utf-8″?> <android.support.v4.widget.SwipeRefreshLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/swipe_container” android:layout_width=”match_parent” android:layout_height=”match_parent”> <android.support.v7.widget.RecyclerView android:id=”@+id/my_recycler_view” android:layout_width=”match_parent” android:layout_height=”match_parent” /> </android.support.v4.widget.SwipeRefreshLayout> 2. In your Tab1History … 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

Make ImageView fit width of CardView

You need to do 2 things : 1) Call setPreventCornerOverlap(false) on your CardView. 2) Put rounded Imageview inside CardView About rounding your imageview, I had the same problem so I made a library that you can set different radii on each corners. There is one good library(vinc3m1’s RoundedImageView) that supports rounded corners on ImageView, but … Read more

How to set the padding for CardView widget in Android L

CardView should handle this using the contentPadding attributes it comes with: <android.support.v7.widget.CardView xmlns:card_view=”http://schemas.android.com/apk/res-auto” android:id=”@+id/card_view” android:layout_gravity=”center” android:layout_width=”match_parent” android:layout_height=”200dp” card_view:cardCornerRadius=”2dp” card_view:contentPaddingLeft=”20dp” card_view:contentPaddingRight=”@dimen/activity_horizontal_margin” card_view:contentPaddingTop=”20dp” card_view:contentPaddingBottom=”@dimen/activity_vertical_margin”> <TextView android:id=”@+id/info_text” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:text=”Hello World!”/> </android.support.v7.widget.CardView>

Round only top corner of cardview

We can set the marginBottom of the card view in negative value.Margin should be same value as card radius. For Example, <FrameLayout android:id=”@+id/rootview” android:layout_width=”match_parent” android:layout_height=”match_parent”> <android.support.v7.widget.CardView android:id=”@+id/card_view” android:layout_marginBottom=”-3dp” project:cardCornerRadius=”3dp” android:layout_width=”match_parent” android:layout_height=”match_parent”> <!–The child view inside the cardview should have extra padding,so that negative margin will not affect the bottom padding of its child.Here normally we … 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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)