You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**assets**: Folder for save all assets from your project.\
9
+
**res:** Folder for save all resources a like texts, layouts, icons, themes, etc.
10
+
11
+
**IMPORTANT:** Ouput folders need follow that structure too.
12
+
13
+
# Create a Hello World
14
+
15
+
You can create a hello world:
16
+
17
+
```java
18
+
19
+
publicclassExampleextendsActivity {
20
+
publicstaticvoidmain(String[] args) {
21
+
Application.initialize(Example::new);
22
+
}
23
+
24
+
@Override
25
+
publicvoid onCreate() {
26
+
super.onCreate();
27
+
View view =newView(this);
28
+
setTitle("Hello world!");
29
+
view.setBackground(newColorDrawable(Color.RED));
30
+
setContentView(view);
31
+
}
32
+
}
33
+
```
34
+
35
+
# Create a UI with XML.
36
+
37
+
For create complex UIs you can use XMLs, first you need create your layout file a like `res/layout/example.xml`, that is a example of a simple Hello world layout:
38
+
39
+
```xml
40
+
<?xml version="1.0" encoding="UTF-8"?>
41
+
<LinearLayout
42
+
width="match_parent"
43
+
height="match_parent"
44
+
background="?colorSurface"
45
+
orientation="horizontal">
46
+
<TextView
47
+
width="match_parent"
48
+
height="match_parent"
49
+
text="Hello world"/>
50
+
</LinearLayout>
51
+
```
52
+
53
+
For import that layout, you can use ``setContentView(layoutId)`` in your activity.
54
+
55
+
```java
56
+
57
+
@Override
58
+
publicvoid onCreate() {
59
+
super.onCreate();
60
+
setContentView("example");
61
+
}
62
+
63
+
```
64
+
65
+
### Change widgets from a xml layout.
66
+
67
+
For access and edit nodes created from xml layout, you can use method: ``findViewById('NODE_ID')``, and set tag id in your node.
0 commit comments