直播app开发搭建,搜索框+含搜索历史记录
直播app开发搭建,搜索框+含搜索历史记录
1.撸个页面
1 | activity_main.xml<br><?xml version= "1.0" encoding= "utf-8" ?><br><LinearLayout<br> xmlns:android= "http://schemas.android.com/apk/res/android" <br> xmlns:app= "http://schemas.android.com/apk/res-auto" <br> xmlns:tools= "http://schemas.android.com/tools" <br> android:layout_width= "match_parent" <br> android:layout_height= "match_parent" <br> android:orientation= "vertical" <br> tools:context= "com.yhx.app.MainActivity" ><br> <RelativeLayout<br> android:textColor= "@color/gray" <br> android:textSize= "14sp" <br> android:layout_marginTop= "10dp" <br> android:layout_width= "match_parent" <br> android:layout_height= "45dp" ><br> <Button<br> android:id= "@+id/btn_serarch" <br> android:layout_width= "80dp" <br> android:layout_height= "match_parent" <br> android:layout_alignParentRight= "true" <br> android:hint= "搜索" /><br> <EditText<br> android:id= "@+id/et_search" <br> android:hint= "输入内容" <br> android:layout_width= "match_parent" <br> android:layout_height= "match_parent" <br> android:layout_toLeftOf= "@id/btn_serarch" /><br> </RelativeLayout><br> <RelativeLayout<br> android:padding= "10dp" <br> android:layout_width= "match_parent" <br> android:layout_height= "wrap_content" ><br> <TextView<br> android:layout_width= "wrap_content" <br> android:layout_height= "wrap_content" <br> android:text= "历史记录" /><br> <TextView<br> android:id= "@+id/tv_deleteAll" <br> android:layout_alignParentRight= "true" <br> android:layout_width= "wrap_content" <br> android:layout_height= "wrap_content" <br> android:text= "删除历史记录" /><br> </RelativeLayout><br> <android.support.v7.widget.RecyclerView<br> android:id= "@+id/mRecyclerView" <br> android:layout_width= "match_parent" <br> android:layout_height= "match_parent" <br> android:layout_marginTop= "10dp" ><br> </android.support.v7.widget.RecyclerView><br></LinearLayout> |
2.使用Android自带的SQLiteOpenHelper来创建表数据
1 | /**<br> * Created by yi.huangxing on 17/12/13.类描述:<br> */ <br> public class RecordSQLiteOpenHelper extends SQLiteOpenHelper{<br> private static String name = "record.db" ;<br> private static Integer version = 1;<br> public RecordSQLiteOpenHelper(Context context) {<br> super(context, name, null, version);<br> }<br> @Override<br> public void onCreate(SQLiteDatabase db) {<br> //打开数据库,建立了一个叫records的表,里面只有一列name来存储历史记录:<br> db.execSQL("create table records(id integer primary key autoincrement,name varchar(200))");<br> }<br> @Override<br> public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {<br> }<br>} |
以上就是直播app开发搭建,搜索框+含搜索历史记录, 更多内容欢迎关注之后的文章
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
2022-06-29 直播软件开发,Android自定义简单的音频波谱view
2022-06-29 直播平台开发,进入可视区域执行动画、动效、添加样式类名
2022-06-29 短视频平台搭建,淡入淡出 支持左滑右滑轮播图