最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時(shí)間:2017年02月11日 11:50:35   作者:CrazyCodeBoy  
這篇文章主要介紹了Android ScrollView嵌套ExpandableListView顯示不正常的問題的解決辦法的相關(guān)資料,需要的朋友可以參考下

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

前言:

   關(guān)于ScrollView嵌套ExpandableListView導(dǎo)致ExpandableListView顯示不正常的問題解決方法有很多,在這里介紹一種小編親自測(cè)試通過的方法。

重寫ExpandableListView:

實(shí)例代碼:

package com.jph.view; 
 
import android.content.Context; 
import android.util.AttributeSet; 
import android.widget.ExpandableListView; 
 
/** 
 * 重寫ExpandableListView以解決ScrollView嵌套ExpandableListView 
 *<br> 導(dǎo)致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"/> 

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

相關(guān)文章

最新評(píng)論

汤原县| 丰镇市| 铜鼓县| 澄城县| 栾川县| 三江| 上犹县| 宜川县| 兴化市| 鹤山市| 泰州市| 永春县| 南雄市| 漳平市| 辽阳市| 满城县| 西吉县| 峨山| 六枝特区| 阿拉尔市| 陆丰市| 舞阳县| 锡林浩特市| 赤水市| 普陀区| 宁蒗| 新郑市| 和静县| 兴山县| 忻州市| 临安市| 堆龙德庆县| 新民市| 泸溪县| 盘山县| 武宁县| 永川市| 达州市| 略阳县| 高雄县| 轮台县|