/**
 * 自定义gridview,解决ScrollView中嵌套gridview显示不正常的问题(1行半)
 *
 */
public class MyGridView extends GridView{
	  public MyGridView(Context context, AttributeSet attrs) { 
	        super(context, attrs); 
	    } 
	 
	    public MyGridView(Context context) { 
	        super(context); 
	    } 
	 
	    public MyGridView(Context context, AttributeSet attrs, int defStyle) { 
	        super(context, attrs, defStyle); 
	    } 
	 
	    @Override 
	    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 
	 
	        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, 
	                MeasureSpec.AT_MOST); 
	        super.onMeasure(widthMeasureSpec, expandSpec); 
	    } 
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
  • 2021-07-30
  • 2021-09-02
  • 2021-12-11
  • 2022-12-23
猜你喜欢
  • 2022-01-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案