安卓佈局控件用match_parent之後控件被擠到屏幕可見範圍外的問題

如圖在這裏插入圖片描述這是問題佈局
這是期望效果這是期望效果。

這是佈局代碼,本身是沒有問題的。<?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 所以希望以後不會再次遇到這樣的坑。查了全網都沒發現有跟我同樣遇到這個問題的小夥伴。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章