Tôi đang cố triển khai ScrollView
trong Android không cuộn khi thêm mục bên trên vị trí cuộn hiện tại.Tạo ScrollView bị khóa trong Android
Việc thực hiện mặc định của ScrollView
cư xử như sau:
Thêm một mục trên vị trí cuộn hiện tại:
Thêm một mục dưới vị trí cuộn hiện tại:
Làm thế nào tôi có thể "khóa" ScrollView
trước khi thêm một mặt hàng trên dòng điện ent di chuyển vị trí?
Đây là tệp bố cục của tôi, tôi hiện đã ghi đè cả số ScrollView
và LinearLayout
nhưng chưa thực hiện bất kỳ thay đổi nào.
<LinearLayout
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_width="fill_parent">
<LinearLayout
android:id="@+id/LinearLayout02"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true">
<Button
android:id="@+id/Button02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" android:text="Add To Top"
android:onClick="addToStart">
</Button>
<Button
android:id="@+id/Button03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Add to End"
android:onClick="addToEnd">
</Button>
</LinearLayout>
<com.poc.scroller.locable.lockablescrollerpoc.LockedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:verticalScrollbarPosition="right"
android:fadeScrollbars="false"
android:background="@color/scrollColor">
<com.poc.scroller.locable.lockablescrollerpoc.LockedLinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/Container">
</com.poc.scroller.locable.lockablescrollerpoc.LockedLinearLayout>
</com.poc.scroller.locable.lockablescrollerpoc.LockedScrollView>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
Ví dụ Mã Nguồn: https://github.com/Amaros90/android-lockable-scroller-poc
Cảm ơn bạn!
cung cấp bố trí đoạn pls –
Thử gọi cuộn đầu trang và di chuyển xuống dưới vào nút bấm –
@AjayVenugopal những gì bạn đang đề xuất sẽ cung cấp cho các ứng dụng hành vi flaky – Amaros