2
2
.
.
1
1
.
.
3
3
K
K
o
o
t
t
l
l
i
i
n
n
I
I
n
n
f
f
o
o
[
[
R
R
]
]
This tutorial shows how to setup Android Studio for specific Kotlin Syntax Highlighting & Tabs & Indents.
Tabs & Indents settings will be applied to already created files only if you Override current File Tabs & Indents.
Content
Syntax Highlighting
Tabs & Indents
Override current File Tabs & Indents
Imports
S
S
y
y
n
n
t
t
a
a
x
x
H
H
i
i
g
g
h
h
l
l
i
i
g
g
h
h
t
t
i
i
n
n
g
g
File
Settings
Editor
Color Scheme
Language Defaults
Kotlin
TestClass.kt
package com.example.testcompose
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.Text
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.setContent
import androidx.ui.tooling.preview.Preview
import com.example.testcompose.ui.TestComposeTheme
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
TestComposeTheme {
// A surface container using the 'background' color from the theme
Surface(color = MaterialTheme.colors.background) {
Greeting("Android")
}
}
}
}
}
@Composable
fun Greeting(name: String) {
Text(text = "Hello123456 $name!")
}
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
TestComposeTheme {
Greeting("Android")
}
}
Language Defaults
Language Defaults
Red
Green
Blue
Bold
Example
Classes - Class name
200
0
0
MyClass
Classes - Class reference
200
0
0
MyClass
Classes - Static method
0
0
0
myFunc()
Comments - Block Comment
0
150
0
/* Multi-line comment. */
Comments - Line Comment
0
150
0
//Single line comment.
Identifiers - Constant
200
0
0
server
Identifiers - Default
200
0
0
server
Identifiers - Function call
0
0
0
myFunc()
Identifiers - Function declaration
0
0
0
myFunc()
Keyword
0
100
200
return
Number
200
0
200
8080
String - String text
200
0
200
"Hello World"
Kotlin
Red
Green
Blue
Bold
Example
Functions - Constructor call
200
0
0
MyClass
Annotations - Annotation attribute
0
100
200
@Override
Annotations - Annotation name
0
100
200
@Override
Errors
Red
Green
Blue
Other
Example
Errors - Unknown symbol
Underwaved (200, 200, 200)
Errors - Warning
Underwaved (0, 128, 0)
T
T
a
a
b
b
s
s
&
&
I
I
n
n
d
d
e
e
n
n
t
t
s
s
File
Settings
Editor
Code Style
Kotlin
Tabs and Indents
Tab size: 2
Indent: 2
OK
Java Tabs & Indents