我正在尝试将ImageButton置于NetworkImageView上方,其中两者都在内部相对布局中,而CardView内部的相对布局和按钮不会显示在其上方;这是我的代码:
<android.support.design.card.MaterialCardView 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"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:cardBackgroundColor="@android:color/transparent"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="true"
app:contentPaddingTop="@dimen/shr_staggered_product_grid_margin_top_first">
<!-- Product card layout used in MDC-103 and onward -->
<RelativeLayout
android:id="@+id/content_layout"
android:layout_width="@dimen/shr_staggered_product_grid_card_width_landscape"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layout_constraintTop_toTopOf="parent">
<com.android.volley.toolbox.NetworkImageView
android:id="@+id/product_image"
android:layout_width="match_parent"
android:layout_height="@dimen/shr_staggered_product_grid_card_height_landscape"
android:background="?attr/colorPrimaryDark"
android:elevation="0dp"
android:scaleType="centerCrop" />
<ImageButton
android:id="@+id/add_to_chart_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="304dp"
android:layout_marginTop="2dp"
android:background="?attr/colorPrimaryDark"
android:elevation="8dp"
app:srcCompat="@drawable/shr_add_to_chart"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</RelativeLayout>
</android.support.design.card.MaterialCardView>
我不明白为什么没有出现任何人可以帮助我。