gpt4 book ai didi

android - 如何使 ListView 垂直放置在 Button 和 ImageView 之间

转载 作者:行者123 更新时间:2023-11-30 04:10:11 25 4
gpt4 key购买 nike

我正在尝试创建一个介于 Button 和 ImageView 之间的 ListView。我有一个 RelativeLayout,它在顶部有一个 Button,在底部有一个 ImageView。我想要它们之间的 ListView。这就是我所做的。

我在 Button 下看到我的 listView,但它与底部的 ImageView 重叠。那么我怎样才能使 ListView 位于 ImageView 之上呢?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/control_panel"
android:layout_width="@dimen/mywidth"
android:layout_height="match_parent"
android:orientation="vertical">

<Button android:id="@+id/button"
android:layout_height="@dimen/button_size"
android:layout_width="@dimen/button_size"
android:scaleType="center"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@drawable/btn_shutter" />

<ListView android:id="@+id/image_list"
android:layout_width="@dimen/button_size"
android:layout_height="wrap_content"
android:drawSelectorOnTop="false"
android:layout_above="@+id/image"
android:layout_below="@+id/button"/>

<ImageView
android:id="@+id/image"
android:layout_width="@dimen/mywidth"
android:layout_height="@dimen/image_height"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"/>

</RelativeLayout>

最佳答案

试试这个

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/control_panel"
android:layout_width="@dimen/mywidth"
android:layout_height="match_parent"
android:orientation="vertical">

<Button android:id="@+id/button"
android:layout_height="@dimen/button_size"
android:layout_width="wrap_content"
android:layout_alignParentTop="true"
android:background="@drawable/btn_shutter" />

<ImageView
android:id="@+id/image"
android:layout_width="@dimen/mywidth"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"/>

<ListView android:id="@+id/image_list"
android:layout_width="@dimen/button_size"
android:layout_height="fill_parent"
android:drawSelectorOnTop="false"
android:layout_above="@+id/image"
android:layout_below="@+id/button"/>


</RelativeLayout>

关于android - 如何使 ListView 垂直放置在 Button 和 ImageView 之间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10984333/

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