Commit 9fcdadb0 authored by wanglei's avatar wanglei

...

parent 846b4fc6
......@@ -4,7 +4,9 @@ import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Color
import androidx.activity.addCallback
import androidx.core.view.isVisible
import androidx.core.view.updatePadding
import androidx.recyclerview.widget.LinearLayoutManager
import com.base.browserwhite.ads.admob.AdmobNativeUtils
import com.base.browserwhite.bean.ConstObject.APP_PROCESS
import com.base.browserwhite.bean.ConstObject.JUNK_CLEANER
......@@ -88,6 +90,26 @@ class ResultActivity : BaseActivity<ActivityResultBinding>() {
finish()
}
})
binding.rvNews.setOnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
// LogEx.logDebug(TAG, "scrollY=$scrollY oldScrollY=$oldScrollY")
// 检查当前滚动位置
val firstVisibleItem: Int =
(binding.rvNews.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition()
if (firstVisibleItem > 3) {
binding.ivUp.isVisible = true
}
if (firstVisibleItem == 0) {
binding.ivUp.isVisible = false
}
}
binding.ivUp.setOnClickListener {
binding.rvNews.scrollToPosition(0)
binding.ivUp.isVisible = false
}
binding.rvNews.adapter = helper.adapter
requestMore()
}
......
......@@ -46,11 +46,29 @@
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_news"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_news"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<ImageView
android:id="@+id/iv_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="30dp"
android:layout_marginBottom="50dp"
android:src="@mipmap/huidingbu"
android:visibility="gone"
tools:ignore="ContentDescription" />
</FrameLayout>
</LinearLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment