[英]My cardview is overlapping all layouts (cards)
我正在嘗試制作一個顯示菜單不同選項的 cardview,但卡片只是相互重疊,我已經遵循了多個教程並完全按照所示重復操作,但 cardview 無法正常工作,我該如何修復它或使其工作適當地? 難道我做錯了什么? xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/purple"
android:orientation="vertical"
tools:context=".MainMenu">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.85"
android:background="@drawable/userpanel">
</RelativeLayout>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.3 " >
<LinearLayout
android:background="@drawable/cardcontainer"
android:layout_width="match_parent"
android:layout_height="150dp"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:background="@drawable/cardcontainer"
android:layout_width="match_parent"
android:layout_height="150dp"
android:orientation="vertical">
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
idk 為什么它會這樣顯示,我以前這樣做過但是項目被刪除了因為我的電腦壞了而且工作得很好,現在不是了
在您的Linear Layout
中,將layout_height
從match_parent
更改為wrap_content
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.