android 重叠view 重叠布局,按比例布局
生活随笔
收集整理的這篇文章主要介紹了
android 重叠view 重叠布局,按比例布局
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
?按比例布局
寬度滿屏,高度9:16
<androidx.constraintlayout.widget.ConstraintLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="0dp"app:layout_constraintTop_toTopOf="parent"app:layout_constraintDimensionRatio="w,9:16"></RelativeLayout></androidx.constraintlayout.widget.ConstraintLayout>使用RelativeLayout即可實(shí)現(xiàn)重疊布局——RelativeLayout標(biāo)簽內(nèi)容里面的下層布局會(huì)浮現(xiàn)在上層布局之上;上層布局會(huì)被下層布局覆蓋
實(shí)現(xiàn)layout:
<RelativeLayoutandroid:layout_width="match_parent"android:layout_height="200dp"android:background="#FFE4C4"><LinearLayoutandroid:layout_width="300dp"android:layout_height="100dp"android:background="#303F9F"></LinearLayout><LinearLayoutandroid:layout_width="200dp"android:layout_height="100dp"android:background="#FF4081"android:layout_marginLeft="50dp"android:layout_marginTop="50dp"></LinearLayout> </RelativeLayout>實(shí)現(xiàn)效果:
總結(jié)
以上是生活随笔為你收集整理的android 重叠view 重叠布局,按比例布局的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: DBeaver - 一款免费开源的通用数
- 下一篇: $.get、$.post 和 $().l