你好,我在Tablayout和ViewPager的切换中遇见头布局显示不完问题,高度一直为158
tushantong opened this issue · comments
期待解决方案: 给一方法,可以获取到 添加进去的自定义头布局,然后控制他的高度。
this.refreshHeaderView = headerView;
this.addView(this.refreshHeaderView);
我的tab和viewpager布局
<!-- 和viewpager 结合的标签 -->
<android.support.design.widget.TabLayout
android:id="@+id/home_tab_"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
app:tabBackground="@android:color/transparent"
app:tabIndicatorColor="@color/pink"
app:tabIndicatorHeight="3dp"
app:tabMode="scrollable"
app:tabSelectedTextColor="@color/pink"
app:tabTextColor="#000"
></android.support.design.widget.TabLayout>
<!-- 首页主内容区域 -->
<android.support.v4.view.ViewPager
android:id="@+id/home_vp_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v4.view.ViewPager>
第一个ViewPager的item 头布局显示正常 log 显示正常,从第二个
com.swm.lightbeauty.view.refresh.MyHeaderView{783f770 V.E...... ......ID 0,-241-1080,0}
第二个log 头布局高度为158 不管怎么我把头布局设置为多高,高度永远被赋为:158我测的是默认头布局的高度
com.swm.lightbeauty.view.refresh.MyHeaderView{1e12920 V.E...... ......ID 0,-158-1080,0}
您好,感谢你的反馈,正在测试
你的列表是recyclerview么?
嗯嗯,麻烦您了。 是recyclerview
<com.ajguan.library.EasyRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/whole_easylayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/whole_refresh_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</com.ajguan.library.EasyRefreshLayout>
是在 tablayout+viewpager+fragment当中遇见的问题,上方布局是fragment的。
// 需要inflate一个布局文件 填充Fragment
mView = inflater.inflate(R.layout.whole_refresh_recycler, container, false);
好的,我试着重现一下
嗯嗯,麻烦您了。
你好,我测试了,无法重现你说的问题,如果有需要的话,你可以贴更多的代码出来,我在示例demo里添加里viewpager+fragment的,你可以试下
首先说声抱歉,没有接收到邮件,没及时回复,抱歉。
我把重现的做成一个小Demo,Clone你可以运行一下,只有几个关键类。
地址为:https://github.com/IsSwm/Test 在这个上面你可以看到相应的问题重现。
期待你的答复。
你好,看了你给的代码,确实出现了你说的问题,现在还没找到原因所在,有新消息会及时给你信息
好的,麻烦你了。我也多看下你的源码共同解决。
OK,后面我会重构一波,有兴趣的话,可以一起来弄
OK的,很乐意。