在上篇文章《

  好了,来讲下今天要完成的效果,在优化了之前部分代码的前提下,今天来说下关于博客搜索和博客详情页的实现,依旧国际惯例,来看下效果图:(动态图片比较大,加载需要点时间)

安卓开发笔记——打造属于自己的博客园APP(四)

  效果比较简单,很多东西我们还是可以复用之前的代码,毕竟这种列表长得都差不多,然后大致功能基本完成了,从下篇文章开始可以引入我们的数据库了,开始实现缓存操作。

 

1、关于搜索页面的实现:

  很简单,分成两部分,上面一个EditText,下面一个RecyclerView,当我们刚进入页面的时候默认展示博客园给我们的推荐用户,当搜索的时候更新列表数据。

  这里是关于博客园推荐用户的接口: http://wcf.open.cnblogs.com/blog/bloggers/recommend/{PAGEINDEX}/{PAGESIZE} {PAGEINDEX}代表页码,{PAGESIZE}代表每页展示的条数

这里是搜索页面的主布局文件:

 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 2     xmlns:tools="http://schemas.android.com/tools"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     android:orientation="vertical">
 6 
 7 
 8     <!--ToolBar-->
 9     <include layout="@layout/activity_toolbar" />
10 
11     <LinearLayout
12         android:layout_width="match_parent"
13         android:layout_height="wrap_content"
14         android:background="@color/md_green_700"
15         android:paddingBottom="10dp"
16         android:paddingLeft="20dp"
17         android:paddingRight="20dp"
18         android:paddingTop="10dp">
19 
20         <RelativeLayout
21             android:layout_width="match_parent"
22             android:layout_height="40dp"
23             android:background="@drawable/bg_search"
24             android:gravity="center_vertical">
25 
26             <ImageButton
27                 android:id="@+id/ib_search"
28                 android:layout_width="wrap_content"
29                 android:layout_height="wrap_content"
30                 android:layout_alignParentRight="true"
31                 android:background="@drawable/bt_search_selector" />
32 
33             <EditText
34                 android:id="@+id/et_text"
35                 android:layout_width="match_parent"
36                 android:layout_height="wrap_content"
37                 android:layout_toLeftOf="@id/ib_search"
38                 android:background="@null"
39                 android:hint="搜索其他博客" />
40         </RelativeLayout>
41     </LinearLayout>
42 
43     <FrameLayout
44         android:layout_width="match_parent"
45         android:layout_height="match_parent">
46 
47         <android.support.v7.widget.RecyclerView
48             android:id="@+id/rv_view"
49             android:layout_width="match_parent"
50             android:layout_height="match_parent"
51             android:background="@color/md_grey_200"
52             android:scrollbars="none" />
53 
54         <com.lcw.rabbit.myblog.view.MyProgressBar
55             android:id="@+id/progressbar"
56             android:layout_width="match_parent"
57             android:layout_height="20dp"
58             android:layout_gravity="bottom"
59             android:visibility="gone" />
60     </FrameLayout>
61 </LinearLayout>
activity_search.xml

相关文章:

  • 2022-12-23
  • 2022-01-13
  • 2021-11-03
  • 2021-12-09
  • 2021-09-04
猜你喜欢
  • 2021-08-02
  • 2021-11-04
  • 2021-09-10
  • 2022-12-23
  • 2021-05-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案