Android ScrollView嵌套ExpandableListView显示不正常的问题的解决办法
2017-02-11 11:50
633 查看
Android 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"/>
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
您可能感兴趣的文章:
- Android之ScrollView嵌套ListView和GridView冲突的解决方法
- Android笔记之:在ScrollView中嵌套ListView的方法
- Android ListView的item中嵌套ScrollView的解决办法
- Android编程之截屏实现方法(包括scrollview与listview)
- Android 中ScrollView嵌套GridView,ListView的实例
- Android ListView与ScrollView冲突的解决方法总结
- Android ScrollView 下嵌套 ListView 或 GridView出现问题解决办法
- Android 中ScrollView与ListView冲突问题的解决办法
- Android开发实现ScrollView中嵌套两个ListView的方法
相关文章推荐
- Android ScrollView嵌套ExpandableListView显示不正常的问题的解决办法
- android程序正常运行,但LogCat没有显示—解决办法
- 关于window2008计划任务前台显示和批处理无法正常执行问题的解决办法
- 关于Android加载HTML页面中的图片显示问题的解决办法
- Active Report for .net"在VS中正常显示在IIS中无法显示"的问题之解决办法
- 解决Android Studio 2.2.3中添加.cpp .h文件在Project->Android无法显示,无法正常编译问题。
- table表格合并列的问题,在IE中能够正常显示,但是在火狐中,好像colspan没有起作用一样,解决办法!!!!
- 解决导入android工程后main.xml Graphical Layout不能正常显示的问题
- Android 6.0 解决recyclerview 在 scrollview 中不能全部显示,高度不正常的问题
- Android 6.0 解决recyclerview 在 scrollview 中不能全部显示,高度不正常的问题
- Android应用程序当中GridView显示不同大小图片时Item挤出问题解决办法
- android listview选中某一行,成选中状态颜色高亮显示,ListView的UI显示中常见问题及解决办法
- 关于Cocos2d-x 3.0正式版 粒子问题在IOS上正常显示,在Android下有问题的解决方式
- fckeditor上传的小窗口在IE9下不能正常显示的问题解决办法
- 解决导入android工程后main.xml Graphical Layout不能正常显示的问题
- Android应用程序当中GridView显示不同大小图片时Item挤出问题解决办法
- android sdk content loader 一直显示0% 问题解决办法
- Android 6.0 解决recyclerview 在 scrollview 中不能全部显示,高度不正常的问题
- Android 6.0 解决recyclerview 在 scrollview 中不能全部显示,高度不正常的问题。
- Android Service中使用Toast无法正常显示问题的解决方法