项目需要的依赖以及一些权限配置;
权限:
<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>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:l