rxjava+retrofit布局

来源:互联网 发布:vb应用程序图标 编辑:程序博客网 时间:2024/05/16 10:00

依赖

compile'com.squareup.retrofit2:retrofit:2.0.0-beta4'
    compile'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
    compile 'com.squareup.okhttp3:okhttp:3.1.2'
    compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0-beta4'
    compile 'com.facebook.fresco:fresco:0.11.0'
    compile 'com.jcodecraeer:xrecyclerview:1.3.2'
    compile 'com.android.support:design:26.+'
    compile 'io.reactivex:rxjava:1.1.0'
    compile 'io.reactivex:rxandroid:1.1.0'
    compile 'com.google.code.gson:gson:2.6.2'


activity_main

 <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:id="@+id/llhead"
        android:orientation="horizontal"
        android:background="#2b4490">
        <TextView
            android:id="@+id/textView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="资讯"
            android:gravity="center"
            android:textColor="#fffffb"
            android:textSize="25sp" />
    </LinearLayout>
    <android.support.design.widget.TabLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/tab"
        android:layout_below="@+id/llhead"></android.support.design.widget.TabLayout>
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/fl"
        android:layout_below="@+id/tab"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true">
    </FrameLayout>
    <RadioGroup
        android:layout_width="match_parent"
        android:layout_height="30dp"
        android:id="@+id/rg"
        android:orientation="horizontal"
        android:layout_alignParentBottom="true"
        >
        <RadioButton
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:id="@+id/rb1"
            android:layout_weight="1"
            android:button="@null"
            android:gravity="center"
            android:background="#afb4db"
            android:text="首页"/>
        <RadioButton
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:id="@+id/rb2"
            android:layout_weight="1"
            android:button="@null"
            android:gravity="center"
            android:background="#afb4db"
            android:text="自选"/>
        <RadioButton
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:id="@+id/rb3"
            android:button="@null"
            android:layout_weight="1"
            android:gravity="center"
            android:background="#afb4db"
            android:text="行情"/>
        <RadioButton
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:id="@+id/rb4"
            android:button="@null"
            android:layout_weight="1"
            android:background="#afb4db"
            android:gravity="center"
            android:text="资讯"/>
        <RadioButton
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:id="@+id/rb5"
            android:layout_weight="1"
            android:button="@null"
            android:background="#afb4db"
            android:gravity="center"
            android:text="交易"/>
    </RadioGroup>


fragment1

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:gravity="center"
    android:layout_height="match_parent">
    <com.jcodecraeer.xrecyclerview.XRecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/xrv">

    </com.jcodecraeer.xrecyclerview.XRecyclerView>
</RelativeLayout>


showitem

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <com.facebook.drawee.view.SimpleDraweeView
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:id="@+id/sdv"/>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:orientation="vertical"
    >
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/tvtop"
        android:textSize="20sp"/>
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/tvbottom"
        android:textSize="15sp"/>
</LinearLayout>
</LinearLayout>




原创粉丝点击