简体   繁体   English

Android Studio - 将 Java 代码导出为 HTML

[英]Android Studio - Export Javacode to HTML

I tryed to export my Javacode from Android Studio to a HTML Code.我尝试将我的 Java 代码从 Android Studio 导出到 HTML 代码。 But when I start the exported HTML-Code in Firefox, Chrome or Opera, I only see the Code and not the Game what I programmed.但是当我在 Firefox、Chrome 或 Opera 中启动导出的 HTML 代码时,我只能看到代码而不是我编写的游戏。 Did I need something else to do like css?我是否需要像 css 那样做其他事情? I hope anyone can help me.我希望任何人都可以帮助我。

Strecki斯特雷基

File > Export to HTML... can't convert your native app(written in Java or Kotlin) into Web app. File > Export to HTML...无法将您的本机应用程序(用 Java 或 Kotlin 编写)转换为 Web 应用程序。 It is like a wrapper to display beautifully the source code files(*.java, *.kt, *.xml, *.aidl, etc)它就像一个包装器,可以精美地显示源代码文件(*.java、*.kt、*.xml、*.aidl 等)

Once you export your project to HTML.将项目导出为 HTML 后。

Firstly, It will creates exportToHTML folder.首先,它会创建exportToHTML文件夹。 Secondly, It will create index.html files in each folder and convert all the file names like these:其次,它将在每个文件夹中创建 index.html 文件并转换所有文件名,如下所示:

MyJavaFile.java > MyJavaFile.java.html
MyXmlFile.xml > MyXmlFile.xml.html
MyAidlFile.aidl > MyAidFile.aidl.html
MyImlFile.iml > MyImlFile.iml.html
(and so on...)

The file structures are similar to the original one.文件结构与原始结构相似。 And each html files has this CSS.每个 html 文件都有这个 CSS。

<style type="text/css">
    .s0 { color: #808080;}
    .s1 { color: #a9b7c6;}
    .s2 { color: #cc7832;}
    .s3 { color: #629755; font-style: italic;}
    .s4 { color: #6a8759;}
    .s5 { color: #6897bb;}
</style>

And the files has tag to display the source code.并且文件有标签来显示源代码。

the index.html files only shows the file names as a hyperlink. index.html 文件仅将文件名显示为超链接。

In this way, the files only display the source files.这样,文件只显示源文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM