現(xiàn)在商城類(lèi)的APP幾乎都要用到流式布局來(lái)實(shí)現(xiàn)選擇屬性功能,在我的demo中是通過(guò)FlowLayout工具類(lèi)實(shí)現(xiàn)流式布局
使用起來(lái)非常簡(jiǎn)單,十幾行代碼就可以實(shí)現(xiàn);
在我們的項(xiàng)目中大部分都是單選效果,為了防止用到多選,demo中也實(shí)現(xiàn)了多選;
FlowLayout大家不用研究怎么實(shí)現(xiàn)的,只要會(huì)使用就好;
就好比谷歌提供的ListView條目點(diǎn)擊事件一樣,只要會(huì)用就好,沒(méi)必要研究個(gè)所以然;大家在用的時(shí)候直接從demo中復(fù)制到項(xiàng)目中即可;
大家可以將FlowLayout理解為一個(gè)線性布局;將準(zhǔn)備好的一個(gè)個(gè)子view添加到FlowLayout中即可;
首先看下布局文件:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"> <!-- app:horizontal_spacing="8dp" 每列之間的距離 app:vertical_spacing="8dp" 每行之間的距離 --> <www.fl.com.flowlayouttext.view.FlowLayout android:id="@+id/flowlayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:paddingBottom="14dp" android:paddingLeft="21dp" android:paddingRight="14dp" app:horizontal_spacing="8dp" app:vertical_spacing="8dp"/> </LinearLayout>
當(dāng)前標(biāo)題:Android流式布局FlowLayout詳解-創(chuàng)新互聯(lián)
本文地址:http://chinadenli.net/article6/epdig.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導(dǎo)航、網(wǎng)頁(yè)設(shè)計(jì)公司、域名注冊(cè)、品牌網(wǎng)站建設(shè)、關(guān)鍵詞優(yōu)化、響應(yīng)式網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容