實現預覽RecyclerView列表項的列表

最外層的佈局文件管理器必須添加:

① xmlns:tools="http://schemas.android.com/tools"引用 ;

② RecyclerView組件中需要制定可視區域,即寬、高:  

        tools:layout_height="80dp"
        tools:layout_width="match_parent"
③  需要制定列表子項的佈局文件:
        tools:listitem="@layout/game_list_item"

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout 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:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >

        <de.hdodenhof.circleimageview.CircleImageView
            android:id="@+id/game_main_head"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_marginLeft="17dp"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            android:src="@drawable/game_icon_default_head" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="你好世界!"
            android:layout_marginTop="20dp"
            android:textColor="@color/black"
            android:layout_marginLeft="8dp"
            />
        <android.support.v7.widget.RecyclerView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="13dp"
            android:layout_marginLeft="8dp"
            android:nestedScrollingEnabled="false"
            android:overScrollMode="never"
            android:scrollbars="none"
            tools:layout_height="35dp"
            tools:layout_width="35dp"
            tools:listitem="@layout/game_head_reward_item"
            />
        <ImageView
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="16dp"
            android:src="@mipmap/game_score"
            />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#FFCF1A"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="22dp"
            android:text="1600"
            />
       <LinearLayout
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:layout_gravity="center"
           android:gravity="center"
           android:orientation="vertical"
           >
           <ImageView
               android:layout_width="30dp"
               android:layout_height="30dp"
               android:layout_marginRight="16dp"
               android:layout_gravity="right"
               android:src="@mipmap/game_msg"
               />
       </LinearLayout>

    </LinearLayout>

    <com.library.banner.BannerLayout
        android:id="@+id/game_main_loop_banner"
        android:layout_width="match_parent"
        android:layout_height="114dp"
        android:layout_marginTop="10dp"
        android:layout_marginBottom="10dp"
        app:autoPlaying="true"
        app:centerScale="1.2"
        app:itemSpace="45"
        app:moveSpeed="1"
        app:showIndicator="false" />
     <android.support.v7.widget.RecyclerView
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:nestedScrollingEnabled="false"
         android:overScrollMode="never"
         android:layout_gravity="center_horizontal"
         android:scrollbars="none"
         tools:layout_height="60dp"
         tools:listitem="@layout/game_five_grid_item"
         />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginTop="15dp"
        android:gravity="center_horizontal"
        >
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="12sp"
            android:layout_gravity="center_vertical"
            android:text="玩過"
            />
        <android.support.v7.widget.RecyclerView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:nestedScrollingEnabled="false"
            android:overScrollMode="never"
            android:scrollbars="none"
            tools:layout_height="32dp"
            tools:listitem="@layout/game_paly_history_item"
            />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:text=">"
            android:layout_gravity="center"
            />
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="15dp"
        android:orientation="horizontal"
        android:gravity="center"
        >
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="8dp"
            android:src="@mipmap/game_hot_go"
            />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="熱遊推薦"
            android:textSize="18sp"
            android:textColor="#000000"
            />
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="8dp"
            android:src="@mipmap/game_hot_go"
            />
    </LinearLayout>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recommend_hot_game_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="15dp"
        tools:layout_height="120dp"
        tools:layout_width="120dp"
        android:layout_gravity="center_horizontal"
        tools:listitem="@layout/game_hot_recommand_item"
        />
    <android.support.v7.widget.RecyclerView
        android:id="@+id/new_game_reservation_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="15dp"
        tools:layout_height="100dp"
        tools:layout_width="100dp"
        android:layout_gravity="center_horizontal"
        tools:listitem="@layout/game_new_reservation_item"
        />
    <android.support.v7.widget.RecyclerView
        android:id="@+id/game_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="15dp"
        tools:layout_height="80dp"
        tools:layout_width="match_parent"
        android:layout_gravity="center_horizontal"
        tools:listitem="@layout/game_list_item"
        />

</LinearLayout>

效果圖:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章