Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/testica/codeeditor

Code editor android library (custom syntax highlighting, number lines, etc)
https://github.com/testica/codeeditor

android android-library code-editor editor edittext highlight-syntax kotlin

Last synced: 3 months ago
JSON representation

Code editor android library (custom syntax highlighting, number lines, etc)

Awesome Lists containing this project

README

        

# Code Editor
[ ![Download](https://api.bintray.com/packages/testica-android/maven/codeeditor/images/download.svg) ](https://bintray.com/testica-android/maven/codeeditor/_latestVersion)

Code Editor is an Android library that simplify the display of code, making easy syntax highlighting and showing number of lines.




## Requirements
- minSdkVersion 15
- compileSdkVersion 28

## Download

Include into the build.gradle file:

```groovy
dependencies {
implementation 'me.testica:codeeditor:1.0.2'
}
```
## Usage

From layout:
```xml

```

Then, manipulate programmatically:

Java:
```java
Editor editor = (Editor) findViewById(R.id.editor);
editor.setText("Hello Android");
```
Kotlin:
```kotlin
editor.setText("Hello Android")
```

### Syntax Highlight Rules

Define a list of rules using a regular expression and color

Java:
```java
editor.setSyntaxHighlightRules(
new SyntaxHighlightRule("[0-9]*", "#00838f"),
new SyntaxHighlightRule("/\\\\*(?:.|[\\\\n\\\\r])*?\\\\*/|(?