添加按钮 - 如何?

时间:2018-06-07 07:49:10

标签: android

look for view and sort button 如何在可滚动列表视图上添加视图和排序按钮

1 个答案:

答案 0 :(得分:0)

如果您想根据图片在布局中添加两个按钮,则已上传到您的问题中,然后您可以将相对布局用作XML的主要布局。

然后进入相对布局,使用仅包含顶级文件管理器,前两个按钮和列表视图的线性布局。

然后将第二个“线性布局”添加到第一个线性布局下方的主要相对布局中。第二个“线性”布局包含两个按钮视图和“过滤器”。

看起来像这样:

<?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">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <!--  here your top search bar comes -->
        <!--  here your horizontal layout with two buttons Rent and Buy are comes.-->
        <!--  here your list or recycler view comes-->

    </LinearLayout>

    <!-- This below layout contains the two button which you want to add as per your question. -->
    <!-- You can add the background or style to layout and buttons as your wish. -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_margin="20dp"
        android:gravity="center"
        android:orientation="horizontal">

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="View" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Sort" />

    </LinearLayout>

</RelativeLayout>