首页 > android Button.java类中的一个方法不明白

android Button.java类中的一个方法不明白

如图 Button.class.getName()是什么意思?


这和Button无关,这是Java的知识。用来获取类名用的。


返回系统控件Button的类名:android.widget.Button


楼上正解,类似于this.getClass().getSimpleName()


   /**
     * Returns the name of the class represented by this {@code Class}. For a
     * description of the format which is used, see the class definition of
     * {@link Class}.
     */
    public String getName() {
        String result = name;
        return (result == null) ? (name = getNameNative()) : result;
    }

返回此Class对象所代表的实体的名称,就是 Button

【热门文章】
【热门文章】