You know, there's a refresh function when you pull from the Android recycling view
But when I pull, I want to write or work on something else
Is there a way to change the image that comes out when you pull it?(Only the round refresh icon always comes out)
Thank you
android
SwipeRefreshLayout
implements a scroll operation by implementing NestedScrollingParent
and NestedScrollingChild
, and the circle view that appears during swiping is set to Circlement
Circleview.
Depending on the scroll value, it can be seen as a structure that handles the visible state change and scale operation of CircleImageView and the rotation operation of CircleProgressDrawable.
I'm not sure exactly what action you want to implement when you pull, but if you're curious about how to change only the image, you can do it as follows.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
for (i in 0 until swipeLayout.childCount) {
val child = swipeLayout.getChildAt(i)
if (child::class.java.simpleName == "CircleImageView") {
(child as ImageView).apply {
Remove setImageDrawable(null) //CircleProgressDrawable
Remove background = null //circle background
setImageResource(R.mipmap.ic_launcher) //Any icon settings
}
break
}
}
}
© 2024 OneMinuteCode. All rights reserved.