1
因此,我使用RecyclerView
以及一些卡片。點擊時,我想在卡片上疊加一層覆蓋,該覆蓋應覆蓋所有內容,但不能更改視圖的大小。由於內容具有不同的尺寸,所以不可能對卡的尺寸進行硬編碼。填充包含`wrap_content`作爲高度的視圖
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--contents and stuff-->
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000" />
</RelativeLayout>
上面的例子是差不多就是我想實現的,但是這顯然是行不通的,因爲View
的和RelativeLayout
的高度相互引用。
我該如何讓View
覆蓋RelativeLayout
裏面的所有內容?
編輯
說明:我遇到的問題與點擊,覆蓋或任何類似的問題無關。我遇到的問題只涉及RelativeLayout
。
你切換視圖的可見性時,你點了一張卡? – AgileNinja
是否嘗試使用FrameLayout而不是相對? – thunder413
@AgileNinja還不完全,我甚至無法看到正確覆蓋該卡,因爲我不知道如何告訴它來填充視圖。 – Timmiej93