gpt4 book ai didi

Android ImageView 在使用 layout_above 时消失

转载 作者:太空宇宙 更新时间:2023-11-03 12:08:30 24 4
gpt4 key购买 nike

我正在使用 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 >

最佳答案

你正在设置 android:layout_alignParentBottom="true" 所以你不能使用 android:layout_above="@+id/likebutton"。简而言之,当您针对父 View 设置某些 subview 时,您不能相对于它设置其他 View 。否则它不会反射(reflect)。

关于Android ImageView 在使用 layout_above 时消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19183390/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com