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

clipboard.png

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

阅读 3.7k
4 个回答

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

   /**
     * 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

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

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

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题