Android—去掉ExpandableListView的箭頭圖標

用到ExpandableListView時有個箭頭圖標系統自帶的在你自定義佈局也不能去掉只要設置一個屬性即可,如下:

  settingLists.setGroupIndicator(null);  ~~~~~~~~~~~~~~~~~此處就是設置自定義的箭頭圖標的。置空則沒有了。

也可以自定義(但是位置還是在那個地方不推薦)如下:

首先,自定義一個expandablelistviewselector.xml文件,具體內容如下: 
Java代碼

<?xml version="1.0" encoding="utf-8"?>   

<selector xmlns:android="http://schemas.android.com/apk/res/android">   

    <item android:state_expanded="true" android:drawable="@drawable/expandablelistviewindicatordown" />   

    <item android:drawable="@drawable/expandablelistviewindicator" />   

</selector>  

加一句代碼如下:

settingLists.setGroupIndicator(this.getResources().getDrawable(R.layout.expandablelistviewselector)); 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章