当前位置:网站首页>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>
边栏推荐
- 驱动开发——HelloWDM驱动
- 组播和广播的知识点梳理
- Fiddler installed the certificate, or prompted that the certificate is invalid
- 饼干(考试版)
- 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
- Principle and performance analysis of lepton lossless compression
- [detailed steps of FreeRTOS shift value for the first time]
- 关于Unity Inspector上的一些常用技巧,一般用于编辑器扩展或者其他
- Selection sort
- Visio draws Tai Chi
猜你喜欢
Postman Association
Postman关联
Zynq learning notes (3) - partial reconfiguration
Use sentinel to interface locally
Embedded development program framework
ORM aggregate query and native database operation
yolov5 tensorrt加速
8. Static file
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
SQL注入漏洞(MSSQL注入)
随机推荐
Raspberry pie 3.5-inch white screen display connection
Postman pre script - global variables and environment variables
饼干(考试版)
[数学建模] 微分方程--捕鱼业的持续发展
内核判断i2c地址上是否挂载外设
Selection sort
Microblogging hot search stock selection strategy
The kernel determines whether peripherals are attached to the I2C address
Fiddler installed the certificate, or prompted that the certificate is invalid
EditorUtility. The role and application of setdirty in untiy
Redis has four methods for checking big keys, which are necessary for optimization
Use sentinel to interface locally
Basic knowledge and examples of binary tree
ISP学习(2)
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
Quatre méthodes de redis pour dépanner les grandes clés sont nécessaires pour optimiser
优秀PM必须经历这3层蜕变!
Postman测试报告
L'introduction en bourse de MSK Electronics a pris fin: 800 millions de RMB d'actifs de Henan étaient des actionnaires
Platformio create libopencm3 + FreeRTOS project