Tôi đang phát triển một ứng dụng Android hoạt động chủ yếu với listview
. Nhưng tôi gặp sự cố khi sử dụng Floating Action Button
cùng với Long ListView
. Vấn đề của tôi là như dưới đây.Làm cách nào để đặt vị trí cố định cho nút thao tác nổi phía trên chế độ xem danh sách rất dài trong Android?
Khi chế độ xem danh sách chỉ có một vài mục. Floating item
có thể được nhìn thấy.
Đây là ảnh chụp màn hình.
Như bạn thấy ở trên, Floating Action Button
vẫn có thể được seen.But khi ListView
có rất nhiều mặt hàng và trở thành quá mức vào màn hình, Floating Action Button
không thể được nhìn thấy.
Đây là ảnh chụp màn hình của
Long Listview
Đối với ảnh chụp màn hình thứ hai, nó không thể là scrolled down
nữa.
Điều tôi muốn đạt được là, tôi muốn đáy nổi luôn ở dưới cùng bên phải của màn hình phía trên Listview
. Giống như vị trí cố định trong HTML
và CSS
.
Tôi muốn
Floating Action Button
luôn ở đây bất kể có bao cao cácListview
là
Đây là file layout của tôi
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:dividerHeight="@dimen/list_item_divider_height"
android:padding="@dimen/list_padding"
android:divider="@color/whitesmoke"
android:id="@+id/listview_podcast_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"></ListView>
<TextView
android:textSize="17dp"
android:textStyle="bold"
android:textColor="@color/black"
android:textAlignment="center"
android:id="@+id/tf_no_records"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/stop_podcast_button"
android:background="@color/colorPrimary"
android:src="@android:drawable/ic_dialog_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"/>
</LinearLayout>
Vì vậy, hãy làm sao tôi có thể sửa mã của tôi thành ach ieve nó. Làm ơn giúp tôi với. Cảm ơn.
Cảm ơn. Nó hoạt động hoàn hảo. –
Tôi sẽ upvote câu trả lời sớm, –
Vui mừng nó đã giúp :) – ajantha