Predefined Layouts
We provide some basic layouts that can be used out of the box without writing your own layouts. Check out the on board layouts in the Layout Documentation
Custom predefined Layouts
You can create your own predefined layouts that can be used to set layouts on the HS 50. Predefined layouts must extend the class NIMMSTALayout and can look like the following.
Info
Check out the Layout Documentation for more examples and explanations.
class MyLayout(text1: String, text2: String): NIMMSTALayout() {
override var layout = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<NimmstaLayout name=\"One Cell Layout with Header\">" +
" <device width=\"1.54\" height=\"1.54\" pxx=\"200\" pxy=\"200\">" +
" <screen default=\"true\" name=\"default\">" +
" <staticElements>" +
" <statusbar/>" +
" <cell horizontalAlignment=\"center\" y=\"40\" name=\"text1\"></cell>" +
" <cell horizontalAlignment=\"center\" y=\"80\" name=\"text2\"></cell>" +
" </staticElements>" +
" </screen>" +
" </device>" +
"</NimmstaLayout>"
init {
parameters["text1"] = text1
parameters["text2"] = text2
}
}
public class MyLayout extends NIMMSTALayout {
String myLayout = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<NimmstaLayout name=\"One Cell Layout with Header\">" +
" <device width=\"1.54\" height=\"1.54\" pxx=\"200\" pxy=\"200\">" +
" <screen default=\"true\" name=\"default\">" +
" <staticElements>" +
" <statusbar/>" +
" <cell horizontalAlignment=\"center\" y=\"40\" name=\"text1\"></cell>" +
" <cell horizontalAlignment=\"center\" y=\"80\" name=\"text2\"></cell>" +
" </staticElements>" +
" </screen>" +
" </device>" +
"</NimmstaLayout>";
public MyLayout(String text1, String text2) {
getParameters().put("text1", text1);
getParameters().put("text2", text2);
super.setLayout(myLayout);
}
}