楼主debug一下tableLayout是不是null

解决方案 »

  1.   

    在监听器中实现findViewById,应该会出问题,最好在oncreate中建立好tableLayout,点击的时候显示就好了
      

  2.   

    这样写是有问题的、  你在点击事件里 调用show方法, 就相当于把show里面的代码放过来 就会出现问题了、放过来一看你就知道有问题了、
      

  3.   

            LayoutInflater inflater = LayoutInflater.from(this);
            inflater.inflate(R.id.platformLayout, null);
    this.addView(tableLayout);