Tôi đang cố hiển thị chính xác (ví dụ 3 mục) trong RecyclerView. ứng dụng web của chúng tôi cho thấy như thế này:Làm cách nào để hiển thị số lượng các mục chính xác trong RecyclerView?
Nếu tôi chuyển mục:
và thả chuột, nó sẽ tự động nói đến điều này:
Trong Android, Tôi đang hiển thị hình ảnh bằng RecyclerView:
Làm cách nào để hiển thị chính xác 3 mục trong khu vực hiển thị của RecyclerView? Làm cách nào để tránh hiển thị các mục "một nửa"? Điều này có thể không?
RecyclerView:
<android.support.v7.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_height="130dp"
android:id="@+id/rvProducts" />
Một mục theo quan điểm tái chế:
<?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">
<ImageView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:padding="10dp"
android:id="@+id/ivProduct"
android:src="@drawable/noimage"/>
</LinearLayout>
Code:
LinearLayoutManager layoutManager
= new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
RecyclerView productImageList = (RecyclerView) view.findViewById(R.id.rvProducts);
productImageList.setLayoutManager(layoutManager);
GalleryRecyclerAdapter adapter = new GalleryRecyclerAdapter(images);
productImageList.setAdapter(adapter);
hiển thị tệp xml của bạn –
xem câu hỏi đã chỉnh sửa của tôi –