Gridview does not comes up using custom class
My gridview does not renders if I am using my derived GridClass, It does render when I add GridView object to myLayout but not when I add My Grid Object/ :( .Here's is th开发者_JAVA百科e code
public class parentClass extends MyotherClass
{
Grid _gridV = null;
public void createGridMenu(GridViewAdapter adp )
{
_gridV = (Grid) inflater.inflate(R.layout.Mygridmenu, null);
_gridV.setAdapter(adp);
MyLinearLayout.add(_gridV);
}
class Grid extends GridView{
Grid()
{
super(myContext);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
//My other methods
}
You are using the wrong constructor. Views inflated from XML require one of the constructors that take an AttributeSet in parameter.
精彩评论