ExpandableListView - group indication is stretch to fit the text size

后端 未结 7 2187
自闭症患者
自闭症患者 2020-12-14 10:36

I have group indication with small icon, and i use groupIndicator to call the selector to draw it but I see android by default stretch that icon to fits the text size

7条回答
  •  无人及你
    2020-12-14 11:34

    It is the implementation for indicator icon on right side in Expandable List View. It is working for me.

    
    

    group_indicator.xml

    
    
        
        
        
    
    
        
            
                
                
            
        
    
        
            
                
                
            
        
    
    
    

    In java source code,

    DisplayMetrics metrics = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int width = metrics.widthPixels;
    
    expListView.setIndicatorBounds(width - GetDipsFromPixel(30), width - GetDipsFromPixel(6));
    expListView.setAdapter(listAdapter);
    

提交回复
热议问题