Reference resources in javadoc

2020-03-08 08:00发布

问题:

Is it possible to reference resource files (e.g. layout files) in javadoc? I could not find this in the developer docs.

回答1:

Yup it is,

In your javadoc: {@link com.yourApp.R.layout#layoutName}



回答2:

I've used #

{@link R.layout#dialog_player_info}

instead of a dot

{@link R.layout.dialog_player_info}

And now it's all OK. Before I was getting this error in Android Studio

Cannot resolve symbol 'R.layout.dialog_player_info' less... (Ctrl+F1) 
This inspection points out unresolved references inside javadoc


回答3:

Yes, but the whole process may involve

  • creating a temp folder
  • copy your source files into this temp folder
  • copy your layout files into this folder (possibly in a doc-files subfolder)
  • running the Javadoc command from this temp folder