Android ScrollView嵌套ExpandableListView顯示不正常的問(wèn)題的解決辦法
Android ScrollView嵌套ExpandableListView顯示不正常的問(wèn)題的解決辦法
前言:
關(guān)于ScrollView嵌套ExpandableListView導(dǎo)致ExpandableListView顯示不正常的問(wèn)題解決方法有很多,在這里介紹一種小編親自測(cè)試通過(guò)的方法。
重寫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顯示不正常的問(wèn)題 * @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ì)本站的支持!
- Android ExpandableListView雙層嵌套實(shí)現(xiàn)三級(jí)樹(shù)形菜單
- Android ExpandableListView實(shí)現(xiàn)下拉刷新和加載更多效果
- Android ExpandableListView單選以及多選實(shí)現(xiàn)代碼
- Android listview ExpandableListView實(shí)現(xiàn)多選,單選,全選,edittext實(shí)現(xiàn)批量輸入的實(shí)例代碼
- Android 關(guān)于ExpandableListView刷新問(wèn)題的解決方法
- Android 關(guān)于ExpandableListView去掉里頭分割線的方法
- Android UI控件ExpandableListView基本用法詳解
- Android改變ExpandableListView的indicator圖標(biāo)實(shí)現(xiàn)方法
- Android中ExpandableListView的用法實(shí)例
- Android ExpandableListView展開(kāi)列表控件使用實(shí)例
- Android ExpandableListView用法示例詳解
相關(guān)文章
Android用PopupWindow實(shí)現(xiàn)自定義overflow
這篇文章主要介紹了Android用PopupWindow實(shí)現(xiàn)自定義overflow的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-11-11詳解Flutter自定義應(yīng)用程序內(nèi)鍵盤的實(shí)現(xiàn)方法
本文將展示如何利用Flutter創(chuàng)建自定義鍵盤小部件,用于在自己的應(yīng)用程序中的Flutter TextField中輸入文本,感興趣的小伙伴可以了解一下2022-06-06Mac OS下為Android Studio編譯FFmpeg解碼庫(kù)的詳細(xì)教程
這篇文章主要介紹了Mac OS下為Android Studio編譯FFmpeg解碼庫(kù)的詳細(xì)教程,包括NDK的配置和Android Studio的配置兩個(gè)部分的內(nèi)容,需要的朋友可以參考下2016-01-01Android中多個(gè)EditText輸入效果的解決方式
這篇文章主要給大家介紹了關(guān)于Android中多個(gè)EditText輸入效果的解決方式,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-01-01Android中通過(guò)外部程序啟動(dòng)App的三種方法
這篇文章主要介紹了Android中通過(guò)外部程序啟動(dòng)App的三種方法,本文講解了直接通過(guò)包名、通過(guò)自定義的Action、通過(guò)Scheme三種方法,并分別給出操作代碼,需要的朋友可以參考下2015-04-04Android Textview實(shí)現(xiàn)顏色漸變滾動(dòng)效果
這篇文章主要為大家詳細(xì)介紹了Android Textview實(shí)現(xiàn)顏色漸變滾動(dòng)效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-10-10Android使用ViewPager實(shí)現(xiàn)左右無(wú)限滑動(dòng)
這篇文章主要為大家詳細(xì)介紹了Android使用ViewPager實(shí)現(xiàn)左右無(wú)限滑動(dòng),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-05-05listview 選中高亮顯示實(shí)現(xiàn)方法
當(dāng)點(diǎn)擊左側(cè)ListView后,選中的一行就會(huì)一直呈高亮狀態(tài)顯示,圖中選中行字的顏色顯示為藍(lán)色(注意:是選中行后一直高亮,而不是只是點(diǎn)擊時(shí)高亮),如果再次點(diǎn)擊另外的一行, 則新的那一行就高亮,下面就來(lái)實(shí)現(xiàn)這個(gè)高亮效果的顯示2012-11-11