簡體   English   中英

如何在Android中制作自定義GridView

[英]How to make custom GridView in android

我想創建一個網格視圖,但是默認的網格視圖沒有用。

我要創建與此圖像相同的網格視圖:

在此處輸入圖片說明

這是我的網格視圖:

<GridView
            android:id="@+id/list_product_grid"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            tools:listitem="@layout/products_page_grid_view"
            android:numColumns="2"
            android:horizontalSpacing="2dp"
            android:gravity="center"
            android:background="#fff"
            android:padding="10dp"
            android:visibility="visible"
            android:verticalSpacing="2dp"/>

而我的快照:

在此處輸入圖片說明

為此,您需要使用Fragment列表構建自定義列表/網格視圖,並為其自定義ListAdapter / ListItem,如本教程有關Android Studio中的List Fragments所示。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM