I am trying to do button click action inside SwipeRefreshLayout
but it is working for the second time but not for the first time click.
Can anyone suggest whats wrong with it?
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:behavior_overlapTop="38dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v4.widget.NestedScrollView
android:id="@+id/nestedScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none">
<android.support.v7.widget.CardView
android:id="@+id/cardview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/margin"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="10dp"
app:cardElevation="4dp"
app:contentPaddingBottom="16dp"
app:contentPaddingLeft="0dp"
app:contentPaddingRight="0dp">
// My button code is here
<Button
android:id="@+id/loadMore"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/recyclerViewJS"
android:layout_margin="30dp"
android:background="@drawable/dashboard_bg"
android:gravity="center"
android:padding="@dimen/padding"
android:text="Load More"
android:textColor="@color/white"
android:visibility="gone" />
</android.support.v7.widget.CardView>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
Got the id of it using Butter Knife:
@BindView(R.id.loadMore)
Button loadMore;
My button click action is here:
@OnClick(R.id.loadMore)
public void onLoadMoreClick() {
loadMoreData();
}
I referred this but no use.
Thanks in advance.