admin管理员组文章数量:1655505
添加依赖
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.administrator.fuxi_05"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner" +
".AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//添加依赖
compile 'com.jcodecraeer:xrecyclerview:1.3.2'
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
compile 'com.xhb:xbanner:1.2.2'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile'com.facebook.fresco:fresco:0.14.1'
}
添加权限
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<!--读取网络状态的权限-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
接下来就是我们的布局了,布局自己调整一下吧
我们需要在res下新建一个anim包
notify_in.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android/apk/res/android">
<!--平移-->
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="50%p"
android:toYDelta="0"/>
<!--渐变-->
<alpha
android:duration="@android:integer/config_mediumAnimTime"
android:fromAlpha="0.0"
android:toAlpha="1.0"/>
</set>
notify_out.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android/apk/res/android">
<!--平移-->
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="0"
android:toYDelta="-50%p"/>
<!--渐变-->
<alpha
android:duration="@android:integer/config_mediumAnimTime"
android:fromAlpha="1.0"
android:toAlpha="0.0"/>
</set>
然后在drawable包下新建
home_title_bar_search_corner_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android/apk/res/android"
android:shape="rectangle"
>
<corners android:radius="20dp"/>
<solid android:color="#F0F2F5" />
</shape>
接下来就是我们layout包下的了
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android/apk/res/android"
xmlns:app="http://schemas.android/apk/res-auto"
xmlns:tools="http://schemas.android/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.shouye.MainActivity">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fr"></FrameLayout>
</LinearLayout>
fragment1.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:orientation="vertical"
xmlns:android="http://schemas.android/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<com.jcodecraeer.xrecyclerview.XRecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/xrc"></com.jcodecraeer.xrecyclerview.XRecyclerView>
<include layout="@layout/shouye_title"></include>
</RelativeLayout>
shouye_jiugongge.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:padding="5px"
android:orientation="vertical"
xmlns:android="http://schemas.android/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<com.facebook.drawee.view.SimpleDraweeView
android:layout_gravity="center_horizontal"
android:layout_width="150px"
android:layout_height="150px"
android:id="@+id/sd"></com.facebook.drawee.view.SimpleDraweeView>
<TextView
android:textSize="60px"
android:layout_gravity="center_horizontal"
android:text="你好啊"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/jiugongge_tv"/>
</LinearLayout>
shouye_title.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:id="@+id/fg"
xmlns:android="http://schemas.android/apk/res/android" android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:gravity="center_horizontal"
android:orientation="vertical"
android:id="@+id/f1_erweima"
android:layout_width="60dp"
android:layout_height="wrap_content">
<ImageView
android:background="#ffffff"
android:src="@drawable/sao"
android:layout_width="24dp"
android:layout_height="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:textColor="#ffffff"
android:text="扫啊扫"/>
</LinearLayout>
<LinearLayout
android:layout_marginLeft="3px"
android:layout_marginRight="3px"
android:background="@drawable/home_title_bar_search_corner_bg"
android:gravity="center_vertical"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="40dp">
<ImageView
android:layout_marginLeft="5dp"
android:src="@drawable/order_find"
android:layout_width="20dp"
android:layout_height="20dp" />
<TextView
android:id="@+id/sousuo"
android:layout_marginLeft="5dp"
android:gravity="center_vertical"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="30dp"
android:textSize="15dp"
android:text="运动户外超级品牌类日"
/>
<ImageView
android:layout_marginRight="5dp"
android:src="@drawable/root"
android:layout_width="20dp"
android:layout_height="20dp" />
</LinearLayout>
<LinearLayout
android:gravity="center_horizontal"
android:orientation="vertical"
android:layout_width="50dp"
android:layout_height="wrap_content">
<ImageView
android:background="#ffffff"
android:src="@drawable/order_msg"
android:layout_width="20dp"
android:layout_height="20dp" />
<TextView
android:textColor="#ffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:text="消息"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
shouye_tuijian.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_marginTop="30px"
android:orientation="vertical"
xmlns:android="http://schemas.android/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:textSize="80px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/shouye_tuijian_tv"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/shouye_tuijian_rc"></android.support.v7.widget.RecyclerView>
</LinearLayout>
shouye_tuijian_zi.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:padding="15px"
android:orientation="vertical"
xmlns:android="http://schemas.android/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<com.facebook.drawee.view.SimpleDraweeView
android:layout_gravity="center_horizontal"
android:layout_width="300px"
android:layout_height="300px"
android:id="@+id/sd"></com.facebook.drawee.view.SimpleDraweeView>
<TextView
android:layout_gravity="center_horizontal"
android:text="你好啊"
android:textSize="40px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/jiugongge_tv"/>
</LinearLayout>
shouye_xbanner.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical"
xmlns:android="http://schemas.android/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android/apk/res-auto">
<com.stx.xhb.xbanner.XBanner
android:layout_width="match_parent"
android:layout_height="300px"
app:AutoPlayTime="2000"
android:id="@+id/myxbanner"></com.stx.xhb.xbanner.XBanner>
</LinearLayout>
shouyemiaosha_item.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
xmlns:android="http://schemas.android/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:textColor="#ff0000"
android:textSize="50px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/shouue_miaosha_tv"/>
<TextView
android:layout_gravity="center_vertical"
android:textSize="30px"
android:id="@+id/shouue_miaosha_tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="60px" />
<LinearLayout
android:layout_gravity="center_vertical"
android:layout_marginLeft="50px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_hour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:background="#000000"
android:textColor="@android:color/white"
android:textSize="12sp"
android:text="02"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textStyle="bold"
android:textColor="@android:color/black"
android:text=":"/>
<TextView
android:background="#000000"
android:id="@+id/tv_minute"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:textColor="@android:color/white"
android:textSize="12sp"
android:text="15"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textStyle="bold"
android:textColor="@android:color/black"
android:text=":"/>
<TextView
android:background="#000000"
android:id="@+id/tv_second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:textColor="@android:color/white"
android:textSize="12sp"
android:text="36"/>
</LinearLayout>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/miaosha_rv"></android.support.v7.widget.RecyclerView>
</LinearLayout>
shouyerc.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
xmlns:android="http://schemas.android/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/shouye_rc"></android.support.v7.widget.RecyclerView>
<LinearLayout
android:layout_marginTop="30px"
android:layout_width="match_parent"
android:layout_height="60dp">
<TextView
android:textSize="50px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:text="京东"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="快报"
android:background="#ff0000"
android:textColor="#ffffffff"
android:textSize="50px"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="50px"
android:textColor="#989898"
android:text=" : "/>
<com.example.shouye.myview.NoticeView
android:id="@+id/notice_view"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<View
android:layout_marginTop="20px"
android:layout_width="3dp"
android:layout_height="100px"
android:layout_marginRight="8dp"
android:alpha="0.3"
android:background="#666666"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="60px"
android:gravity="center"
android:text="更多"
android:textColor="#666666"
android:textSize="50px"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="50px"></View>
</LinearLayout>
呼呼 终于写完我们的布局了,接下来就该写我们的代码了
bean
Jiugongge_bean.java
package com.example.shouye.bean;
import java.util.List;
/**
* Created by Administrator on 2018/2/18.
*/
public class Jiugongge_bean {
/**
* msg :
* code : 0
* data : [{
"cid":1,"createtime":"2017-10-10T19:41:39","icon":"http://120.27.23.105/images/category/shop.png","ishome":1,"name":"京东超市"},{
"cid":2,"createtime":"2017-10-10T19:41:39","icon":"http://120.27.23.105/images/category/qqg.png","ishome":1,"name":"全球购"},{
"cid":3,"createtime":"2017-10-10T19:45:11","icon":"http://120.27.23.105/images/category/phone.png","ishome":1,"name":"手机数码"},{
"cid":5,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/man.png","ishome":1,"name":"男装"},{
"cid":6,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/girl.png","ishome":1,"name":"女装"},{
"cid":7,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/manshoe.png","ishome":1,"name":"男鞋"},{
"cid":8,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/girlshoe.png","ishome":1,"name":"女鞋"},{
"cid":9,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/shirt.png","ishome":1,"name":"内衣配饰"},{
"cid":10,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/bag.png","ishome":1,"name":"箱包手袋"},{
"cid":11,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/beauty.png","ishome":1,"name":"美妆个护"},{
"cid":12,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/jewel.png","ishome":1,"name":"钟表珠宝"},{
"cid":13,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/luxury.png","ishome":1,"name":"奢侈品"},{
"cid":14,"createtime":"2017-10-10T20:12:03","icon":"http://120.27.23.105/images/category/computer.png","ishome":1,"name":"电脑办公"},{
"cid":15,"createtime":"2017-09-29T10:13:48","icon":"http://120.27.23.105/images/icon.png","ishome":
版权声明:本文标题:仿京东首页(MVP+轮播+跑马灯+秒杀+GridView+宫格展示) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1729704963a1210636.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论