Change expandable indicator in ExpandableListView

前端 未结 7 801
野趣味
野趣味 2020-11-29 18:51

Trying to create an ExpandableListView. The initial view with the groups shows up fine. However, when I click the list item, my arrow does not change. See the images below.<

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-29 19:53

    expandable listview

     
    

    setindicator here iam useing setindicator code like this this working nice

     DisplayMetrics metrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(metrics);
        int width = metrics.widthPixels; 
    
     mExpandableList = (ExpandableListView)findViewById(R.id.expandable_list);
     mExpandableList.setIndicatorBounds(width - GetPixelFromDips(50), width - GetPixelFromDips(10));  
    
       public int GetPixelFromDips(float pixels) {
        // Get the screen's density scale 
        final float scale = getResources().getDisplayMetrics().density;
        // Convert the dps to pixels, based on density scale
        return (int) (pixels * scale + 0.5f);
    }
    

    res/drawable/group_indicator

      
    
                     
                             
                               
               
         
    

提交回复
热议问题