Reputation: 12316
i have a SwipeRefreshLayout with a listview, this listview has a emptyview, but when the listview its empty, it show his emptyview, but the refresh on SwipRefreshlayout doesnt work..
Why?
Upvotes: 2
Views: 585
Reputation: 1
I also met this problem. To fix it, you can set the emptyView clickable, like this
View emptyView = findViewById(R.id.empty);
emptyView.setClickable(true);
commentsLV.setEmptyView(emptyView);
I found this solution in Android support v4 SwipeRefreshLayout empty view issue first comment).
However, it makes the swipeRefreshlayout can swipe at wrong position.You can fix it by extending swipeRefreshlayout, or reference this SwiperefreshLayout in Android
If you want a convenient solution while using swiperefreshlayout, you can put your listview and emptyview in a framelayout and decide the visibility of emprtyview in your code.
Upvotes: 0