首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >安卓ListView高度为match_parent减去固定高度

安卓ListView高度为match_parent减去固定高度
EN

Stack Overflow用户
提问于 2018-06-20 04:42:00
回答 2查看 446关注 0票数 0

我有一个包含listview的LinearLayout,在底部我有一个包含3个按钮的realativeLayout。

代码语言:javascript
复制
   <LinearLayout
    android:id="@+id/ListView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:descendantFocusability="beforeDescendants"
    android:orientation="vertical"
    android:visibility="visible"
    tools:layout_editor_absoluteY="8dp">

        <ListView
        android:id="@+id/listdogs"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:choiceMode="singleChoice"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:listSelector="@android:color/darker_gray"
        android:textSize="10dp"
        android:layout_marginBottom="80dp"
        android:visibility="visible">


    </ListView>

<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="80dp">

        <Button
            android:id="@+id/dogmap"
            android:layout_width="70dp"
            android:layout_height="68dp"
            android:layout_alignParentStart="true"
            android:layout_alignParentTop="true"
            android:layout_marginStart="21dp"
            android:background="@drawable/map" />

        <Button
            android:id="@+id/dogphone"
            android:layout_width="70dp"
            android:layout_height="68dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:background="@drawable/phone" />

        <Button
            android:id="@+id/dogaweb"
            android:layout_width="70dp"
            android:layout_height="68dp"
            android:layout_alignParentEnd="true"
            android:layout_alignParentTop="true"
            android:layout_marginEnd="26dp"
            android:background="@drawable/website" />
    </RelativeLayout>

</LinearLayout>

我希望列表视图设置为: android:layout_height="match_parent“,但我希望它从那个高度减去-80dp,这样就可以显示底部的relativeLayout。

我原以为如果我添加android:layout_marginBottom="80dp“,就可以给我展示relativeLayout所需的空间,但事实并非如此。它只是在那里添加了一个空白区域,并将我的按钮移出屏幕。

提前感谢您的支持

问候

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50936642

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档