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

歡迎訪問 生活随笔!

生活随笔

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

Android

云炬Android开发笔记 16附加功能开发(二维码,一键分享,分页,搜索)

發(fā)布時間:2025/3/15 Android 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 云炬Android开发笔记 16附加功能开发(二维码,一键分享,分页,搜索) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

閱讀目錄


1.二維碼高性能解決方案

1.1推薦的庫的使用
1.2 掃描到數(shù)據(jù)回調的處理
2. 一鍵分享功能的使用

2.1 第三方功能的使用
2.2 邏輯增加
2.3 編譯測試
3.分頁功能實現(xiàn)
?4. 搜索功能的實現(xiàn)

?


?

?

?

回到頂部

1.二維碼高性能解決方案

回到頂部

1.1推薦的庫的使用

【添加依賴】zxing是谷歌純java寫的;zbar是日本純c寫的,效率高;

【動態(tài)權限的添加】

【二維碼事件處理的delegate】

【掃描view】

?

【二維碼掃描框的view】

?

?【完善調用邏輯】

【權限的補充】

回到頂部

1.2 掃描到數(shù)據(jù)回調的處理

?

?

回到頂部

2. 一鍵分享功能的使用

回到頂部

2.1 第三方功能的使用

【說明】接入共需要五步;

?

【第一步】【需要增加shareSDK和第三方平臺的key和secret】

?

【第二步】

?

【第三步】

【第四步】

?

【第五步】

?

回到頂部

2.2 邏輯增加

【在發(fā)現(xiàn)頁面使用】

?

回到頂部

2.3 編譯測試

【說明】在debug版本的apk在真機上是無法使用一鍵分享功能的,需要編譯成為release版本才可以;

?

?

回到頂部

3.分頁功能實現(xiàn)

?【下拉分頁的功能】多條數(shù)據(jù)的加載

回到頂部

?4. 搜索功能的實現(xiàn)

?

?

【search的layout】使用到了recycleView;

1 <?xml version="1.0" encoding="utf-8"?>2 <LinearLayout 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:id="@+id/tb_main_page"9 android:layout_width="match_parent" 10 android:layout_height="80dp" 11 android:background="@color/app_main"> 12 13 <android.support.v7.widget.LinearLayoutCompat 14 android:layout_width="match_parent" 15 android:layout_height="match_parent" 16 android:orientation="horizontal"> 17 18 <com.joanzapata.iconify.widget.IconTextView 19 android:id="@+id/icon_top_search_back" 20 android:layout_width="0dp" 21 android:layout_height="match_parent" 22 android:layout_gravity="left" 23 android:layout_weight="0.6" 24 android:gravity="center" 25 android:paddingRight="10dp" 26 android:text="{fa-arrow-left}" 27 android:textColor="@android:color/white" 28 android:textSize="25sp" /> 29 30 <android.support.v7.widget.AppCompatEditText 31 android:id="@+id/et_search_view" 32 android:layout_width="0dp" 33 android:layout_height="40dp" 34 android:layout_gravity="center" 35 android:layout_weight="4" 36 android:background="@android:color/white" 37 android:gravity="center_vertical" 38 android:hint="搜索" 39 android:paddingLeft="20dp" /> 40 41 <android.support.v7.widget.AppCompatTextView 42 android:id="@+id/tv_top_search" 43 android:layout_width="0dp" 44 android:layout_height="match_parent" 45 android:layout_gravity="right" 46 android:layout_weight="1" 47 android:gravity="center" 48 android:text="搜索" 49 android:textColor="@android:color/white" 50 android:textSize="18sp" /> 51 52 </android.support.v7.widget.LinearLayoutCompat> 53 54 </android.support.v7.widget.Toolbar> 55 56 <android.support.v7.widget.RecyclerView 57 android:id="@+id/rv_search" 58 android:layout_width="match_parent" 59 android:layout_height="match_parent" /> 60 </LinearLayout>

?

【recycleView的數(shù)據(jù)轉換】使用sp進行搜索之后的關鍵字的保存;

?

【數(shù)據(jù)適配器】

?

【搜索之后的數(shù)據(jù)的存儲】

【數(shù)據(jù)適配器的設置】

?【補充】現(xiàn)在我們的數(shù)據(jù)是存儲在sp中,一般的是存在數(shù)據(jù)庫中;

?

【正常的數(shù)據(jù)的存儲的做法】將請求的數(shù)據(jù)累計到數(shù)據(jù)庫中,當打開searchView的時候,將數(shù)據(jù)取出,然后進行數(shù)據(jù)的取出轉換,然后顯示;

?

?

?

總結

以上是生活随笔為你收集整理的云炬Android开发笔记 16附加功能开发(二维码,一键分享,分页,搜索)的全部內容,希望文章能夠幫你解決所遇到的問題。

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