Home  >  Article  >  Web Front-end  >  [开源] Android 代码高亮控件_html/css_WEB-ITnose

[开源] Android 代码高亮控件_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:14:561221browse

CodeViewCodeView ,按照字面意思,就是用来显示代码,并有能够进行代码高亮的一个View类型。这里是通过hightlight.js 渲染代码,可以自动识别主流的各种语言比如java,c++,c#,python,bash,ruby。。。。等等等语言并且有很多种主题风格,可以自由选择一种主题,然后将其显示比如:

既可以显示单个代码片段,也可以把html文件中所有指定的代码替换为高亮显示出来。比如对于下面的原本的html文件。

<!DOCTYPE html><html><head>    <title></title></head><body><h1>This is a code</h1><pre class="code">#include<stdio.h>int main(){    printf("hello world");}

This is another code

class Main{    private String name;    Main(String name){        this.name=name;    }    public static void main(String []args){        Main main=new Main("hello");        System.out.println("init");    }}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn