如圖這是問題佈局
這是期望效果。
這是佈局代碼,本身是沒有問題的。<?xml version="1.0" encoding="utf-8"?>
<data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/web_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<WebView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
但是。。。問題就出在這裏。。。
然後佈局就亂了。。。不要這個windowFu’llscreen就正常了。經過測試應該是有這個主題之後測量方式不一樣。
僅以此記錄遇到的坑。我找了好久都沒找到問題。然後確實發現我的代碼沒有問題 T.T 所以希望以後不會再次遇到這樣的坑。查了全網都沒發現有跟我同樣遇到這個問題的小夥伴。