[英]Why does the GridLayout cover the whole screen?
我有以下HTML代碼:
<GridLayout>
<GridLayout #background class="background">
</GridLayout>
<StackLayout #initialContainer class="initial-container">
<Image src="res://logo_login">
</Image>
....
....
</StackLayout>
</GridLayout>
我的問題是關於帶有background
類的GridLayout。
這是該類的CSS:
.background {
background-image: url("res://apple");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
}
顯然是實際背景(此處為橙色背景,而不是徽標!)。
問題我不明白為什么GridLayout會覆蓋整個屏幕。 即使這樣做,我也希望StackLayout在GridLayout之后。 我已經知道background-size:cover
覆蓋整個空間,但是為什么GridLayout也可以覆蓋整個屏幕? 以及為什么徽標和標題不在我的CSS中時顯示為絕對定位?
您的外部布局是GridLayout,如果您不指定行和列,則布局內的任何布局或項目都將在最左上角的網格單元中彼此堆疊,以使其在html中分層。 要解決此問題,請將外部布局交換為StackLayout
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.