0
在下面的代碼(自定義列表項)中,Button視圖不可見,它就像ImageView佔用所有位置並且不允許它顯示,我應該如何修改代碼使其出現在ImageView的底部和空間的其餘部分?無法讓我的按鈕視圖出現在RelativeLayout中
<RelativeLayout
android:id="@+id/inner_container_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_with_shadow">
<!-- Title -->
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginRight="25dp"
android:layout_marginEnd="25dp"/>
<!-- Sub Title -->
<TextView
android:id="@+id/sub_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_below="@+id/title"/>
<!-- Ad thumbnail -->
<ImageView
android:id="@+id/cover"
android:background="@drawable/drop_shadow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_below="@+id/sub_title"
android:scaleType="fitXY"
android:src="@android:color/transparent"/>
<Button
android:id="@+id/Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cover"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:text="Button"/>
</RelativeLayout>
對不起,在運行時它給了我這個錯誤:java.lang.IllegalStateException:在RelativeLayout中不存在循環依賴關係 – Jack
您確定要使用我發佈的確切代碼嗎? –
謝謝,它的工作,我只需要從