search

Home  >  Q&A  >  body text

android - 继承一个BaseAdapter类后重写了一些方法,但是这些方法在父类中找不到,这是为什么?

继承BaseAdapter类

class MyAdapter extends BaseAdapter{

        @Override
        public int getCount() {
            return 0;
        }

        @Override
        public Object getItem(int position) {
            return null;
        }

        @Override
        public long getItemId(int position) {
            return 0;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            return null;
        }
    }

这是父类中的方法

伊谢尔伦伊谢尔伦2771 days ago657

reply all(4)I'll reply

  • 高洛峰

    高洛峰2017-04-17 17:27:24

    Because these methods are shown in BaseAdapter从它的父类或者实现接口中继承来的,需要开启Show inherited才能在Structure.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:27:24

    The guide package is wrong.

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 17:27:24

    BaseAdapter是个抽象类,实现了ListAdapter接口,getCountgetItem这几个方法都在ListAdapter接口里,但是BaseAdapter没写具体实现,所以你要继承BaseAdapterYou must write the implementation of these methods.

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 17:27:24

    Methods in subclasses cannot be found in the parent class of course, they are not the same class. Methods in the parent class can be found in the child class.

    reply
    0
  • Cancelreply