题目要求:
1, (25分) 使用TabLayout实现页面的导航切换
2, (25分) 实现ViewPager + Fragment ,切换页面, 2个Fragment;
3, (25分) 第一个Fragment中, 获取网络数据,展示到RecyclerView
地址: http://app.vmoiver.com/apiv3/post/getPostInCate?cateid=0&p=1
解析字段: title , image
4, (25分) 第二个Fragment中, 通过webView展示http://baidu.com网页信息
效果图
代码实例:
导入jar包
xUtils 和 gson 的jar包
添加依赖:
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support:recyclerview-v7:25.3.1'
一, 页面:
main_activity.html
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="bw.com.day18_test.MainActivity"> <android.support.design.widget.TabLayout android:layout_width="match_parent"