美文网首页
AndroidStudio 修改注释渲染(documentati

AndroidStudio 修改注释渲染(documentati

作者: 笨鱼天阳 | 来源:发表于2021-11-25 12:41 被阅读0次

    Android Studio Setting

    本文:https://blog.csdn.net/CrazyApes/article/details/121553219

    前言

    更新了最新版的 Android Studio Arctic Fox 之后,发现看源码的时候,注释都是渲染成文档状态了。这样挺方便阅读的。而且可以直接点击链接跳转等操作。以如下图为例:

    android.os.Handler#Handler.png

    好倒是挺好的,方便了阅读源码。也可以快速查看相关的方法和类。但是,有个比较恶心的问题,这个方法其实是有 @hide 注解的,而被 @hide javadoc属性的类和方法的集合是不能通过SDK访问的API。如下代码所示,这样看来,注释渲染为 documentation comments 后并未展示 @hide 相关内容,这就难受了,看半天,准备用的时候,一脸问号,咋没法访问。。。

        /**
         * Use the {@link Looper} for the current thread
         * and set whether the handler should be asynchronous.
         *
         * Handlers are synchronous by default unless this constructor is used to make
         * one that is strictly asynchronous.
         *
         * Asynchronous messages represent interrupts or events that do not require global ordering
         * with respect to synchronous messages.  Asynchronous messages are not subject to
         * the synchronization barriers introduced by {@link MessageQueue#enqueueSyncBarrier(long)}.
         *
         * @param async If true, the handler calls {@link Message#setAsynchronous(boolean)} for
         * each {@link Message} that is sent to it or {@link Runnable} that is posted to it.
         *
         * @hide
         */
        public Handler(boolean async) {
            this(null, async);
        }
    
    

    解决办法

    • 快捷键切换 或者 鼠标切换

    默认快捷键切换方式是 Ctrl + Alt + Q
    或者点击注解左侧边栏的那个小笔
    就可以切换回源码方式。
    如下图:

    Toggle Rendered View.png
    • 修改Studio设置

    路径为:Settings > Editor > Reader Mode > Rendered documentation comments
    取消勾选即可。如下图:

    Settings.png

    参考

    本文:AndroidStudio 修改注释渲染

    相关文章

      网友评论

          本文标题:AndroidStudio 修改注释渲染(documentati

          本文链接:https://www.haomeiwen.com/subject/klyatrtx.html