开发者

Gridview does not comes up using custom class

开发者 https://www.devze.com 2023-02-07 13:15 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号