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

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

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

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

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

相關文章

最新評論

牡丹江市| 孟村| 河间市| 许昌市| 大石桥市| 南漳县| 乌鲁木齐市| 邹平县| 大城县| 湄潭县| 荔波县| 铁力市| 韶关市| 吐鲁番市| 蒙自县| 大同市| 东丽区| 阜阳市| 施甸县| 灵武市| 肃宁县| 淳化县| 武强县| 潞西市| 藁城市| 忻州市| 老河口市| 鄂尔多斯市| 宁阳县| 商丘市| 桂平市| 祁东县| 和硕县| 陵水| 绥化市| 峨边| 黔东| 于田县| 滨海县| 冷水江市| 阿拉善盟|