底层build.gradle
ext{ retrofitVersion = '2.4.0' rxandroid = '2.1.0' butterknife = '8.8.1' okhttp = '3.11.0' }
继承base
本app的build.gradle
compile 'com.squareup.retrofit2:converter-scalars:2.0.0' compile 'com.facebook.fresco:fresco:0.11.0' compile 'com.hjm:BottomTabBar:1.1.1' implementation 'com.sunfusheng:marqueeview:1.3.2' compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-14' compile 'org.greenrobot:eventbus:3.0.0' compile 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' compile 'com.jcodecraeer:xrecyclerview:1.5.9' compile 'com.youth.banner:banner:1.4.9' compile 'com.github.bumptech.glide:glide:3.7.0' compile 'com.gyf.immersionbar:immersionbar:2.3.1' compile "com.squareup.retrofit2:retrofit:$rootProject.ext.retrofitVersion" compile "com.squareup.retrofit2:converter-gson:$rootProject.ext.retrofitVersion" compile "com.squareup.retrofit2:adapter-rxjava2:$rootProject.ext.retrofitVersion" compile 'io.reactivex.rxjava2:rxandroid:2.1.0' compile 'com.squareup.okhttp3:okhttp:3.11.0' compile 'com.squareup.okhttp3:logging-interceptor:3.11.0' testCompile 'junit:junit:4.12' compile project(':base') } configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == 'com.android.support') { if (!requested.name.startsWith("multidex")) { details.useVersion '25.0.1' } } } }
AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.CAMERA" /> <application android:name=".app.App"
activity_main.xml
<com.hjm.bottomtabbar.BottomTabBar android:id="@+id/tab_var" android:layout_width="match_parent" android:layout_height="match_parent" />
activity_fragment1.xml
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center" android:background="#CCCCCC" > <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="8" android:gravity="center" android:text="购物车" android:textSize="25dp"/> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="2" android:gravity="center" android:text="编辑" android:textSize="18dp"/> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1px" android:background="#909090"/> <android.support.v7.widget.RecyclerView android:id="@+id/carGV" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="8" /> <RelativeLayout android:id="@+id/cart_bottom_layout" android:padding="5dp" android:background="#CCCCCC" android:textColor="#C0C0C0" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"> <CheckBox android:layout_centerVertical="true" android:id="@+id/allCheckbox" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/totalpriceTv" android:layout_centerVertical="true" android:layout_toRightOf="@+id/allCheckbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="总价:¥0.0"/> <Button android:id="@+id/buy" android:layout_alignParentRight="true" android:text="去结算" android:textSize="20dp" android:textColor="#fff" android:background="#F23030" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </RelativeLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="#CCCCCC"/>
three_yi.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="