国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Android > 正文

Android ScrollView嵌套ExpandableListView顯示不正常的問題的解決辦法

2019-12-12 03:45:38
字體:
來源:轉載
供稿:網友

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"/> 

感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 呈贡县| 宁国市| 桃园县| 阜阳市| 共和县| 中山市| 中卫市| 大姚县| 咸丰县| 临沂市| 玉林市| 东阳市| 噶尔县| 康定县| 卓资县| 江油市| 常德市| 柯坪县| 永嘉县| 滦平县| 兖州市| 浮山县| 舒兰市| 漳州市| 射洪县| 深水埗区| 融水| 南开区| 濮阳县| 黎城县| 衡水市| 邵阳县| 宝山区| 札达县| 资阳市| 韶关市| 宾阳县| 博爱县| 山东| 铜梁县| 稷山县|