RelativeLayout doesn't allow view overlapped whereas LinearLayout does.
时间: 2024-05-27 22:13:31 浏览: 12
This statement is not entirely accurate.
RelativeLayout allows views to overlap each other if they are positioned relatively to each other. For example, if two views are positioned with the same top or bottom constraint, they can overlap. However, it is generally not recommended to use RelativeLayout to create overlapping views as it can lead to unexpected behavior and may not work properly on different screen sizes.
LinearLayout, on the other hand, does not inherently allow views to overlap. However, it is possible to create overlapping views in LinearLayout by using negative margins, which is generally not recommended and can lead to unexpected behavior.
In summary, while it is technically possible to create overlapping views in both RelativeLayout and LinearLayout, it is not recommended and may not work properly on different screen sizes. It is best to use other layout techniques, such as ConstraintLayout, to avoid overlapping views.
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pptx](https://img-home.csdnimg.cn/images/20210720083543.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)