使用layout_above时,Android ImageView会消失

Gin*_*as_ 3 layout android relativelayout

我正在使用RelativeLayout并试图在图像下面制作几个按钮.当我使用android:layout_above="@+id/likebutton"它时,为什么ImageView会消失?怎么让它不消失?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/listitem_shape" >

<TextView
    android:id="@+id/title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textStyle="bold"
    android:layout_marginLeft="10dp"
    android:layout_marginTop="15dp"
    android:layout_marginBottom="10dp" />

<ProgressBar
    android:id="@+id/progressbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

<ImageView
    android:id="@+id/imageview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/likebutton"
    android:layout_below="@+id/title" />

<ImageButton
    android:id="@+id/likebutton"
    android:layout_width="40dp"
    android:layout_height="40dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:background="@drawable/like"/>

<ImageButton
    android:id="@+id/sharebutton"
    android:layout_width="40dp"
    android:layout_height="40dp"
    android:layout_alignParentBottom="true"
    android:layout_toRightOf="@+id/likebutton"
    android:background="@drawable/share" />
</RelativeLayout >
Run Code Online (Sandbox Code Playgroud)

Jat*_*wal 5

您正在设置,android:layout_alignParentBottom="true"因此您无法使用android:layout_above="@+id/likebutton".简而言之,当您针对父视图设置一些子视图时,您无法设置相对于它的其他视图.否则它不会反映出来.