android 重叠view 重叠布局,按比例布局
生活随笔
收集整理的這篇文章主要介紹了
android 重叠view 重叠布局,按比例布局
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?按比例布局
寬度滿屏,高度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即可實現重疊布局——RelativeLayout標簽內容里面的下層布局會浮現在上層布局之上;上層布局會被下層布局覆蓋
實現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>實現效果:
總結
以上是生活随笔為你收集整理的android 重叠view 重叠布局,按比例布局的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: DBeaver - 一款免费开源的通用数
- 下一篇: $.get、$.post 和 $().l