当前位置:网站首页>February 12 relativelayout
February 12 relativelayout
2022-07-06 04:59:00 【Double 0】
1. Relative layout starts from the upper left corner of the interface , Therefore, the latter of two consecutive relative layouts will mask the former
for example , Red is covered by green
<?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">
<RelativeLayout
android:background="#ff0000"
android:layout_width="100dp"
android:layout_height="100dp"/>
<RelativeLayout
android:background="#00ff00"
android:layout_width="100dp"
android:layout_height="100dp"/>
</RelativeLayout>
2. Locate according to the parent container ( Based on the outermost layer )
Show the red
<?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">
<RelativeLayout
android:background="#ff0000"
android:layout_alignParentRight="true"
android:layout_width="100dp"
android:layout_height="100dp"/>
<RelativeLayout
android:background="#00ff00"
android:layout_width="100dp"
android:layout_height="100dp"/>
</RelativeLayout>
3. Locate according to the container
Because there are many brother containers , So which one should be set id
Set the red layout id
android:id="@+id/rl1"
Note that @+id
The green layout is @id
android:layout_toLeftOf="@id/rl1"
4. Set the margin between the component and the parent container
Distance from left 100dp
android:layout_marginLeft="100dp"
Up, down, left and right offset 100dp
android:layout_margin="100dp"
5. Set the margin of elements inside the component
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="100dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/rl1"
android:background="#ff0000"
android:layout_centerInParent="true"
android:layout_width="100dp"
android:layout_height="100dp"/>
<RelativeLayout
android:background="#00ff00"
android:layout_width="100dp"
android:layout_height="100dp"/>
</RelativeLayout>
边栏推荐
- Codeforces Round #804 (Div. 2)
- [数学建模] 微分方程--捕鱼业的持续发展
- The video in win10 computer system does not display thumbnails
- EditorUtility. The role and application of setdirty in untiy
- Delete subsequence < daily question >
- SQL injection vulnerability (MSSQL injection)
- 麥斯克電子IPO被終止:曾擬募資8億 河南資產是股東
- [NOIP2008 提高组] 笨小猴
- Chip debugging of es8316 of imx8mp
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
猜你喜欢
The underlying structure of five data types in redis
A blog to achieve embedded entry
Class inheritance in yyds dry inventory C
Postman Association
Orm-f & Q object
Crazy God said redis notes
SQL注入漏洞(MSSQL注入)
Sqlserver query results are not displayed in tabular form. How to modify them
acwing周赛58
Delete subsequence < daily question >
随机推荐
Ad20 is set with through-hole direct connection copper sheet, and the bonding pad is cross connected
Acwing week 58
A blog to achieve embedded entry
Vite configures the development environment and production environment
[try to hack] John hash cracking tool
Application of Flody
Why does MySQL need two-phase commit
Flink kakfa data read and write to Hudi
Selection of slow motion function
Zynq learning notes (3) - partial reconfiguration
Sorting out the knowledge points of multicast and broadcasting
2021 robocom world robot developer competition - undergraduate group (semi-finals)
[buuctf.reverse] 159_[watevrCTF 2019]Watshell
Crazy God said redis notes
RT thread analysis log system RT_ Kprintf analysis
RTP gb28181 document testing tool
關於Unity Inspector上的一些常用技巧,一般用於編輯器擴展或者其他
MPLS experiment
Visio draws Tai Chi
[detailed steps of FreeRTOS shift value for the first time]