fragment联动与RecycleView请求数据(包含retrofit,Fresco,EventBus与GreenDao结合MVP)

本文介绍了一个Android项目,其中结合了MVP模式、Fragment联动、RecycleView、Retrofit网络请求、Fresco图片加载、EventBus事件总线以及GreenDao数据库操作。详细讲述了依赖配置、权限设置、界面布局、数据模型以及各个组件的使用方法,提供了一个简单的Demo示例。
摘要由CSDN通过智能技术生成

项目需要的依赖以及一些权限配置;

权限:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

 依赖:

compile 'com.jakewharton:butterknife:7.0.0'
    compile 'org.greenrobot:eventbus:3.1.1'
    compile 'com.facebook.fresco:fresco:0.14.1'
    compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
    compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
    compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
    compile'org.greenrobot:greendao:3.0.1'
    compile'org.greenrobot:greendao-generator:3.0.0'
greendao的配置:

如何配置:http://blog.csdn.net/guoleisb10/article/details/78690374

 greendao {
        schemaVersion 1
        daoPackage 'com.bawei.guolei.zhoukaomonidemo.dao'
        targetGenDir 'src/main/java'
    }
apply plugin: 'org.greenrobot.greendao'
classpath 'org.greenrobot:greendao-gradle-plugin:3.0.0'


项目布局:


activity_main:放置fragment底部按钮:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
  >
    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/group"
        />

    <RadioGroup
        android:id="@+id/group"
        android:layout_alignParentBottom="true"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="#118a8a8a"
        android:orientation="horizontal">

        <RadioButton
            android:id="@+id/radio_01"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:button="@null"
            android:checked="true"
            android:gravity="center"
            android:text="首页" />


        <RadioButton
            android:id="@+id/radio_02"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:button="@null"
            android:gravity="center"
            android:text="想法" />

        <RadioButton
            android:id="@+id/radio_03"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:button="@null"
            android:gravity="center"
            android:text="市场" />

        <RadioButton
            android:id="@+id/radio_04"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:button="@null"
            android:gravity="center"
            android:text="通知" />
        <RadioButton
            android:id="@+id/radio_05"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:button="@null"
            android:gravity="center"
            android:text="更多" />
    </RadioGroup>




</RelativeLayout>


fragment_01:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:l
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值