日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

云炬Android开发笔记 11主界面-商品分类开发(多布局Section RecyclerView)

發布時間:2025/3/15 Android 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 云炬Android开发笔记 11主界面-商品分类开发(多布局Section RecyclerView) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

閱讀目錄


1.?分類頁面結構解析和開發

1.1 布局的創建
1.2 布局的邏輯組合
2. 分類左側列表數據解析與UI呈現

2.1 數據的轉換
2.2【完善list列表邏輯】
3.多布局Section列表實現與分類列表點擊事件

1.?分類頁面結構解析和開發

【說明】底部的是一個大的容器fragment,左邊的是一個fragment,右邊是一個fragment;

【說明】分類的界面的內容分為兩類,左邊的是list,右邊是與list對應的詳情頁面;因此,在文件夾分類的時候也是:content詳情頁面;list:分類頁面;

回到頂部

1.1 布局的創建

?

【源碼】layout/delegate_sort.xml

1 <?xml version="1.0" encoding="utf-8"?>2 <android.support.v7.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"3 android:layout_width="match_parent"4 android:layout_height="match_parent"5 android:orientation="vertical">6 7 <android.support.v7.widget.Toolbar8 android:layout_width="match_parent"9 android:layout_height="60dp" 10 android:background="@android:color/holo_orange_dark" 11 android:gravity="center"> 12 13 <android.support.v7.widget.AppCompatTextView 14 android:layout_width="match_parent" 15 android:layout_height="match_parent" 16 android:gravity="center" 17 android:paddingTop="6dp" 18 android:text="分類" 19 android:textColor="@android:color/white" 20 android:textSize="20sp" /> 21 22 </android.support.v7.widget.Toolbar> 23 24 <android.support.v7.widget.LinearLayoutCompat 25 android:layout_width="match_parent" 26 android:layout_height="match_parent" 27 android:background="@color/app_background" 28 android:baselineAligned="true" 29 android:orientation="horizontal"> 30 31 <android.support.v7.widget.ContentFrameLayout 32 android:id="@+id/vertical_list_container" 33 android:layout_width="0dp" 34 android:layout_height="match_parent" 35 android:layout_weight="1" /> 36 37 <android.support.v7.widget.ContentFrameLayout 38 android:id="@+id/sort_content_container" 39 android:layout_width="0dp" 40 android:layout_height="match_parent" 41 android:layout_marginLeft="8dp" 42 android:layout_marginRight="8dp" 43 android:layout_weight="2.5" /> 44 45 </android.support.v7.widget.LinearLayoutCompat> 46 47 </android.support.v7.widget.LinearLayoutCompat>

?

?

回到頂部

1.2 布局的邏輯組合

【說明】將邏輯寫在onLazyInitView中,加載的時機是在點擊分類按鈕之后才會加載;

?如果寫在onCreateView中,則會打開APP的時候就會加載;

?

【左側列表】

?

【內容詳情頁】

?

?

回到頂部

2. 分類左側列表數據解析與UI呈現

【說明】將整個data取出,然后分門別類的將其解析成為一個個的bean數據;

?

回到頂部

2.1 數據的轉換

?

【增加分類的類別】

?

回到頂部

2.2【完善list列表邏輯】

?

【數據適配器】

?

【list的布局】

?

【點擊事件的添加】

?

回到頂部

3.多布局Section列表實現與分類列表點擊事件

【contentfragment】

【初始化數據的框架】

【bean的書寫】一個id下的內容組成了一個bean;

[單個item的bean]

[id對應的一個contentSection詳情數據]

【數據請求】

【適配器的設置】

?

【完善adapter】

?

【適配器的使用】

?

總結

以上是生活随笔為你收集整理的云炬Android开发笔记 11主界面-商品分类开发(多布局Section RecyclerView)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。