Android中Recyclerview使用8----Recyclerview的嵌套

Recyclerview嵌套Recyclerview常规思路,在外层Recyclerview的条目中写内层Recyclerview

Recyclerview嵌套ListView或者GridView往往只能显示一行,解决方法自定义ListView或者GridView

下面是对GridView的自定义

listview也一样:

<pre name="code" class="java"><span style="font-size:18px;">package com.app.android;

import android.widget.GridView;

/**
 * Created by Administrator on 2016/7/28.
 * 对内部的GridView进行设置不要让他设置一行
 */
public class MyGridView extends  GridView{

    public MyGridView(android.content.Context context,
                      android.util.AttributeSet attrs) {
        super(context, attrs);
    }

    /**
     * 设置不滚动
     */
    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
                MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, expandSpec);

    }

}
</span>


 
listView嵌套GridView的demo,其他的思路都一样 

源码下载

http://download.csdn.net/detail/zhaihaohao1/9591211

相关文章
相关标签/搜索