ScrollView嵌套ExpandableListView显示不正常的问题
关于ScrollView嵌套ExpandableListView导致ExpandableListView显示不正常的问题解决方法有非常多,在这里介绍一种小编亲自測试通过的方法。
重写ExpandableListView:
package com.jph.view; import android.content.Context;
import android.util.AttributeSet;
import android.widget.ExpandableListView; /**
* 重写ExpandableListView以解决ScrollView嵌套ExpandableListView
*<br> 导致ExpandableListView显示不正常的问题
* @author jph
* Date:2014.10.21
*/
public class CustomExpandableListView extends ExpandableListView { public CustomExpandableListView(Context context) {
super(context);
// TODO Auto-generated constructor stub
} public CustomExpandableListView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
} public CustomExpandableListView(Context context, AttributeSet attrs,
int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// TODO Auto-generated method stub
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}
}
在XML中将ExpandableListView替换为重写的ExpandableListView就可以。
<com.jph.view.CustomExpandableListView android:id="@+id/elItems"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
ScrollView嵌套ExpandableListView显示不正常的问题的更多相关文章
- ExpandableListView使用(三)-ScrollView嵌套ExpandableListView,列表显示不全
前言 ScrollView嵌套ExpandableListView会出现ExpandableListView列表显示不全,目前比较好的方法是复写ExpandableListView,重写里面的onMe ...
- ScrollView嵌套ListView显示不完全、嵌套TextView不能滚动解决办法
目录: 一.情景说明 二.最初做法 三.解决办法 一.情景说明 1.情景 最近项目刚好有一个需求,需要在一个界面中用ScrollView嵌套一个滚动的TextView和一个listView ...
- ScrollView嵌套listview显示一行bug
首先看看修复bug之后的显示对比图,结果一目了然 显示一行之前 修改bug之后 主要就是ScrollView嵌套listview显示计算 直接上代码 一目了然 <com.wechaotou ...
- Android--------解决ScrollView中嵌套ExpandableListView显示不全的问题
##***Scrollview和ExpandableListView嵌套显示不全*** - 当我们将ExpandableListView嵌套在Scrollview之中时,我们必须要确保我们的不居中Ex ...
- ScrollView嵌套Linearlayout显示不全的解决办法
以为ScrollView只能嵌套一个元素,所以把几个控件都包裹在了一个LinearLayout中了.但是发现底部显示不全,滑动不到最底下. 代码: <ScrollView android:id= ...
- scrollview 嵌套imageview显示长图
起初使用代码如下:但是图片显示不全,上半截被截 <ScrollView android:layout_width="match_parent" android:layout_ ...
- scrollview嵌套recyclerview显示不全现象
只需在recyclerview的外层加入一个父布局就好了 <RelativeLayout android:layout_width="match_parent" androi ...
- 解决Scrollview 嵌套recyclerview不能显示,高度不正常的问题
我们先看一个效果,问题说的就是中间的Grid效果在Scrollview 嵌套recyclerview显示问题,在Android Api 24是好的,不过在5,1,1版本(api 22)缺出现了问题 最 ...
- android listView多层嵌套listView显示不全问题
最近在做项目,需要用到listVIew多层嵌套listVIew的需求,先发现已下两个处理办法比较好用 第一种: public class ListViewNesting extends ListVie ...
随机推荐
- 10 Future Web Trends 十大未来互联网趋势
转载自:http://blog.sina.com.cn/s/blog_4be577310100ajpb.html 我们很满意自己进入的当前网络纪元,通常被称为Web 2.0.这个阶段互联网的特征包括搜 ...
- Python入门 六、像个 Pythonista
pickle import pickle test_data = ['Save me!',123.456,True] f = file('test.data','w') pickle.dump(tes ...
- Selenium获取input值的两种方法:WebElement.getAttribute("value")和WebElement.getText()
在页面元素的定位中,有时候需要获取到元素的页面显示值,用来作为断言.例如,我需要获取email的值"amy1111@xxx.com". <input class=" ...
- HBase的集群搭建(1、3、5节点都适用)
见 5 hbase-shell + hbase的java api
- C#之经理评分系统
PM类,几乎全是属性 using System; using System.Collections.Generic; using System.Linq; using System.Text; usi ...
- 【Oracle】详解ADDM工具
一.ADDM简介 在Oracle9i及之前,DBA们已经拥有了很多很好用的性能分析工具,比如,tkprof.sql_trace.statspack.set event 10046& ...
- Embedded之Makefile
1 Header files The header files are empty, so you can create them with touch: $ touch a.h $ touch b. ...
- 三维重建7:Visual SLAM算法笔记
VSLAM研究了几十年,新的东西不是很多,三维重建的VSLAM方法可以用一篇文章总结一下. 此文是一个好的视觉SLAM综述,对视觉SLAM总结比较全面,是SLAM那本书的很好的补充.介绍了基于滤波器的 ...
- 安卓系统使用摄像头API
原文链接:定制自己的安卓Camera 参考链接:http://blog.csdn.net/tankai19880619/article/details/9075839 ...
- 【sqli-labs】 less6 GET - Double Injection - Double Quotes - String (双注入GET双引号字符型注入)
同less5 单引号改成双引号就行 http://localhost/sqli/Less-6/?id=a" union select 1,count(*),concat((select ta ...