Tôi có nội dung cố định trong chế độ xem văn bản bên trong chế độ xem cuộn. Khi người dùng cuộn đến một vị trí nhất định, tôi muốn bắt đầu một hoạt động hoặc kích hoạt một Toast
.Android scrollview onScrollChanged
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:id="@+id/scroller">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:layout_width="fill_parent" android:id="@+id/story"
android:layout_height="wrap_content" android:text="@string/lorem"
android:gravity="fill" />
</LinearLayout>
</ScrollView>
Vấn đề của tôi là trong việc thực hiện các phương pháp bảo vệ onScrollChanged
để tìm ra vị trí của các điểm di chuyển.
Tôi đã tìm thấy câu trả lời là this, có một giải pháp dễ dàng hơn cho việc này thay vì khai báo một giao diện hay không, qua đi xe scrollview vv như đã thấy trên liên kết tôi đã đăng?
bạn có thể sử dụng http: // stackoverflow.com/questions/10316743/detect-end-of-scrollview –