A language to create layout
Write in .amx (Amix) and convert to Android Views (XML).
allprojects {
repositories {
maven("https://jitpack.io")
}
}
implementation("com.github.AmixLang:Amix:<version>")
config(
orientation = "horizontal"
)
Column(
width = "match_parent",
height = "match_parent"
) {
Button(
id = "shoot_button",
text = "Shoot",
width = "wrap_content",
height = "wrap_content
)
}
- What's config field?: Config field is used to store config layout
Available Config's:
style
: a theme for ui (more used on Robok Engine)
orientation
: a orientation for layout, landscape portrait etc.
(These Config are just returned in theonGenerateCode
, they are not added to the xml code.)
fun main(vararg args: String) {
val context: Context = /* Obtain your Context, ex: from an Activity or Application */
val amix = Amix.Builder(context)
.setUseStyle(false) // Enable style in Components, (will add a tag in componnets to use Robok components, like background
.setUseVerticalRoot(false) // Use orientation vertical in root view if true
.setUseComments(false) // Enable comments in xml code (not recommended)
.setCode("<example-code>") // some amix code
.setOnGenerateCode { generatedCode, config ->
// here you can do something with your generated Android Views XML Layout code
}
.setOnError { errorMessage ->
// when some error happens
println("Error: $errorMessage")
}
.create()
amix.compile() // compile the code
}