RelativeLayout is your best friend if you want to make a flexible UI. You can position its child views relative to the layout itself or relative to other views.
Main.axml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#2196F3"
android:textSize="70sp"
android:text="2nd" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/second"
android:layout_toRightOf="@id/second"
android:background="#F44336"
android:textSize="70sp"
android:text="1st" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/second"
android:layout_toLeftOf="@id/second"
android:background="#4CAF50"
android:textSize="70sp"
android:text="3rd" />
</RelativeLayout>
|


0 comments:
Post a Comment
Note: only a member of this blog may post a comment.