-
-
Save leelei/2fd9671a678120eaed4a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.fixview; | |
import android.content.Context; | |
import android.util.AttributeSet; | |
import android.widget.GridView; | |
/** | |
* Created by new on 14-10-13. | |
* 纯粹是为了修复GridView在wrap_content下只显示一半的问题 | |
*/ | |
public class NoScrollGridView extends GridView { | |
public NoScrollGridView(Context context) { | |
super(context); | |
} | |
public NoScrollGridView(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
@Override | |
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,MeasureSpec.AT_MOST); | |
super.onMeasure(widthMeasureSpec, expandSpec); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment