Android 滚动视图使工具栏在棒棒糖制作前的设备上消失

Android 滚动视图使工具栏在棒棒糖制作前的设备上消失,android,android-layout,android-toolbar,android-scrollview,Android,Android Layout,Android Toolbar,Android Scrollview,在棒棒糖制作之前的设备上,工具栏消失了,但是如果我将滚动条可见性设置为消失了,工具栏就会出现。它在运行棒棒糖或更高版本的设备上运行良好 以下是预期的视图: 以下是我的布局: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.c

在棒棒糖制作之前的设备上,工具栏消失了,但是如果我将滚动条可见性设置为
消失了
,工具栏就会出现。它在运行棒棒糖或更高版本的设备上运行良好

以下是预期的视图:

以下是我的布局:

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

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@android:color/transparent"
        android:elevation="0.5dp">

        <TextView
            android:id="@+id/toolbarText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="About Desh Travel"
            android:textColor="#ffffff"
            android:textSize="20sp"
            android:visibility="invisible" />
    </android.support.v7.widget.Toolbar>

    <ScrollView
        android:id="@+id/busInformationActivityScrollView"
        android:layout_width="fill_parent"
        android:layout_height="match_parent">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#FFFFFF"
            android:paddingBottom="20dp">


            <!-- Image for the bus cover-->

            <ImageView
                android:id="@+id/busCover"
                android:layout_width="match_parent"
                android:layout_height="198dp"
                android:contentDescription="Cover for the Bus"
                android:scaleType="fitXY" />

            <!-- Layout for the Bus name and the rating-->

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignBottom="@+id/busCover"
                android:background="#28000000"
                android:padding="7dp">

                <TextView
                    android:id="@+id/busName"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="12dp"
                    android:layout_marginStart="12dp"
                    android:text="Desh Travels"
                    android:textColor="#FFF"
                    android:textSize="20sp" />

                <com.iarcuschin.simpleratingbar.SimpleRatingBar
                    android:id="@+id/ratingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="end|center_vertical"
                    android:layout_marginEnd="12dp"
                    android:layout_marginRight="12dp"
                    android:visibility="gone"
                    app:srb_borderColor="#f1bc0e"
                    app:srb_fillColor="#e5e917"
                    app:srb_numberOfStars="5"
                    app:srb_rating="3"
                    app:srb_starBackgroundColor="#f7f9d8"
                    app:srb_starBorderWidth="0.5"
                    app:srb_starSize="15dp"
                    app:srb_starsSeparation="2dp"
                    app:srb_stepSize="1" />

            </FrameLayout>

            <!-- Description of the bus-->

            <TextView
                android:id="@+id/busDescription"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/busCover"
                android:layout_marginTop="2dp"
                android:gravity="start"
                android:padding="20dp"
                android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus non turpis quam. Sed at sagittis felis. Maecenas blandit vestibulum lorem, quis efficitur diam tempus in."
                android:textColor="#3E3E3E"
                android:textSize="12.5sp" />

            <!--Separator-->

            <View
                android:id="@+id/viewSeparator"
                android:layout_width="match_parent"
                android:layout_height="0.5dp"
                android:layout_below="@+id/busDescription"
                android:layout_marginLeft="55dp"
                android:layout_marginRight="55dp"
                android:layout_marginTop="5dp" />

            <!-- Info of the bus-->

            <!-- 1st Para-->
            <TextView
                android:id="@+id/launchedTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_below="@+id/viewSeparator"
                android:layout_marginLeft="20dp"
                android:layout_marginStart="20dp"
                android:text="Launched"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <TextView
                android:id="@+id/totalBusTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/viewSeparator"
                android:layout_centerHorizontal="true"
                android:layout_marginLeft="90dp"
                android:layout_marginStart="90dp"
                android:text="Total Bus"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <TextView
                android:id="@+id/acBusTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_alignParentRight="true"
                android:layout_below="@+id/viewSeparator"
                android:layout_marginEnd="20dp"
                android:layout_marginRight="20dp"
                android:text="AC Bus"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <!--1st Info Para-->

            <TextView
                android:id="@+id/launched"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/launchedTitle"
                android:layout_alignStart="@id/launchedTitle"
                android:layout_alignTop="@id/launchedTitle"
                android:layout_marginTop="15dp"
                android:text="2009"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <TextView
                android:id="@+id/totalBus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/totalBusTitle"
                android:layout_alignStart="@id/totalBusTitle"
                android:layout_alignTop="@id/totalBusTitle"
                android:layout_marginTop="15dp"
                android:text="50"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <TextView
                android:id="@+id/acBus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/acBusTitle"
                android:layout_alignStart="@id/acBusTitle"
                android:layout_alignTop="@id/acBusTitle"
                android:layout_marginTop="15dp"
                android:text="24"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <!-- 2nd Para-->

            <TextView
                android:id="@+id/nonACBusTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/launched"
                android:layout_alignStart="@id/launched"
                android:layout_alignTop="@id/launched"
                android:layout_marginTop="25dp"
                android:text="Non AC Bus"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <TextView
                android:id="@+id/busRatingTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/totalBus"
                android:layout_alignStart="@id/totalBus"
                android:layout_alignTop="@id/totalBus"
                android:layout_marginTop="25dp"
                android:text="Rating"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <TextView
                android:id="@+id/eTicketTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/acBus"
                android:layout_alignStart="@id/acBus"
                android:layout_alignTop="@id/acBus"
                android:layout_marginTop="25dp"
                android:text="eTicket"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <!-- 2nd Info Para-->

            <TextView
                android:id="@+id/nonACBus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/nonACBusTitle"
                android:layout_alignStart="@id/nonACBusTitle"
                android:layout_alignTop="@id/nonACBusTitle"
                android:layout_marginTop="15dp"
                android:text="26"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <TextView
                android:id="@+id/busRating"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/busRatingTitle"
                android:layout_alignStart="@id/busRatingTitle"
                android:layout_alignTop="@id/busRatingTitle"
                android:layout_marginTop="15dp"
                android:text="Rate"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <TextView
                android:id="@+id/eTicket"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/eTicketTitle"
                android:layout_alignStart="@id/eTicketTitle"
                android:layout_alignTop="@id/eTicketTitle"
                android:layout_marginTop="15dp"
                android:text="Yes"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <!-- Counter List Button-->

            <Button
                android:id="@+id/counterListButton"
                style="?android:attr/borderlessButtonStyle"
                android:layout_width="match_parent"
                android:layout_height="32dp"
                android:layout_below="@id/busRating"
                android:layout_centerHorizontal="true"
                android:layout_marginLeft="45dp"
                android:layout_marginRight="45dp"
                android:layout_marginTop="35dp"
                android:background="#00D463"
                android:paddingLeft="22dp"
                android:paddingRight="22dp"
                android:text="Counter List"
                android:textAllCaps="false"
                android:textColor="#FFF"
                android:textSize="15sp" />


            <ImageView
                android:id="@+id/firstImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/counterListButton"
                android:layout_marginRight="18dp"
                android:layout_marginTop="20dp"
                android:layout_toLeftOf="@+id/secondImage"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />

            <ImageView
                android:id="@+id/secondImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/counterListButton"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="20dp"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />

            <ImageView
                android:id="@+id/thirdImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/counterListButton"
                android:layout_marginLeft="18dp"
                android:layout_marginTop="20dp"
                android:layout_toRightOf="@+id/secondImage"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />


            <ImageView
                android:id="@+id/fourthImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/firstImage"
                android:layout_marginRight="18dp"
                android:layout_marginTop="18dp"
                android:layout_toLeftOf="@+id/fifthImage"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />

            <ImageView
                android:id="@+id/fifthImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/firstImage"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="18dp"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />

            <ImageView
                android:id="@+id/sixthImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/firstImage"
                android:layout_marginLeft="18dp"
                android:layout_marginTop="18dp"
                android:layout_toRightOf="@+id/fifthImage"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />

        </RelativeLayout>
    </ScrollView>
</RelativeLayout>

加载项滚动视图

编辑


对于不同的滚动行为,您可以将
AppBarLayout
CoordinatorLayout
一起使用,请参见更新的:

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


    <ScrollView
        android:id="@+id/busInformationActivityScrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#FFFFFF"
            android:paddingBottom="20dp">

            <!-- Image for the bus cover-->
            <ImageView
                android:id="@+id/busCover"
                android:layout_width="match_parent"
                android:layout_height="198dp"
                android:contentDescription="Cover for the Bus"
                android:scaleType="fitXY" />

            <!-- Layout for the Bus name and the rating-->

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignBottom="@+id/busCover"
                android:background="#28000000"
                android:padding="7dp">

                <TextView
                    android:id="@+id/busName"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="12dp"
                    android:layout_marginStart="12dp"
                    android:text="Desh Travels"
                    android:textColor="#FFF"
                    android:textSize="20sp" />

                <com.iarcuschin.simpleratingbar.SimpleRatingBar
                    android:id="@+id/ratingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="end|center_vertical"
                    android:layout_marginEnd="12dp"
                    android:layout_marginRight="12dp"
                    android:visibility="gone"
                    app:srb_borderColor="#f1bc0e"
                    app:srb_fillColor="#e5e917"
                    app:srb_numberOfStars="5"
                    app:srb_rating="3"
                    app:srb_starBackgroundColor="#f7f9d8"
                    app:srb_starBorderWidth="0.5"
                    app:srb_starSize="15dp"
                    app:srb_starsSeparation="2dp"
                    app:srb_stepSize="1" />

            </FrameLayout>

            <!-- Description of the bus-->

            <TextView
                android:id="@+id/busDescription"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/busCover"
                android:layout_marginTop="2dp"
                android:gravity="start"
                android:padding="20dp"
                android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus non turpis quam. Sed at sagittis felis. Maecenas blandit vestibulum lorem, quis efficitur diam tempus in."
                android:textColor="#3E3E3E"
                android:textSize="12.5sp" />

            <!--Separator-->

            <View
                android:id="@+id/viewSeparator"
                android:layout_width="match_parent"
                android:layout_height="0.5dp"
                android:layout_below="@+id/busDescription"
                android:layout_marginLeft="55dp"
                android:layout_marginRight="55dp"
                android:layout_marginTop="5dp" />

            <!-- Info of the bus-->

            <!-- 1st Para-->
            <TextView
                android:id="@+id/launchedTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_below="@+id/viewSeparator"
                android:layout_marginLeft="20dp"
                android:layout_marginStart="20dp"
                android:text="Launched"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <TextView
                android:id="@+id/totalBusTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/viewSeparator"
                android:layout_centerHorizontal="true"
                android:layout_marginLeft="90dp"
                android:layout_marginStart="90dp"
                android:text="Total Bus"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <TextView
                android:id="@+id/acBusTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_alignParentRight="true"
                android:layout_below="@+id/viewSeparator"
                android:layout_marginEnd="20dp"
                android:layout_marginRight="20dp"
                android:text="AC Bus"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <!--1st Info Para-->

            <TextView
                android:id="@+id/launched"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/launchedTitle"
                android:layout_alignStart="@id/launchedTitle"
                android:layout_alignTop="@id/launchedTitle"
                android:layout_marginTop="15dp"
                android:text="2009"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <TextView
                android:id="@+id/totalBus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/totalBusTitle"
                android:layout_alignStart="@id/totalBusTitle"
                android:layout_alignTop="@id/totalBusTitle"
                android:layout_marginTop="15dp"
                android:text="50"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <TextView
                android:id="@+id/acBus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/acBusTitle"
                android:layout_alignStart="@id/acBusTitle"
                android:layout_alignTop="@id/acBusTitle"
                android:layout_marginTop="15dp"
                android:text="24"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <!-- 2nd Para-->

            <TextView
                android:id="@+id/nonACBusTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/launched"
                android:layout_alignStart="@id/launched"
                android:layout_alignTop="@id/launched"
                android:layout_marginTop="25dp"
                android:text="Non AC Bus"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <TextView
                android:id="@+id/busRatingTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/totalBus"
                android:layout_alignStart="@id/totalBus"
                android:layout_alignTop="@id/totalBus"
                android:layout_marginTop="25dp"
                android:text="Rating"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <TextView
                android:id="@+id/eTicketTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/acBus"
                android:layout_alignStart="@id/acBus"
                android:layout_alignTop="@id/acBus"
                android:layout_marginTop="25dp"
                android:text="eTicket"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <!-- 2nd Info Para-->

            <TextView
                android:id="@+id/nonACBus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/nonACBusTitle"
                android:layout_alignStart="@id/nonACBusTitle"
                android:layout_alignTop="@id/nonACBusTitle"
                android:layout_marginTop="15dp"
                android:text="26"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <TextView
                android:id="@+id/busRating"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/busRatingTitle"
                android:layout_alignStart="@id/busRatingTitle"
                android:layout_alignTop="@id/busRatingTitle"
                android:layout_marginTop="15dp"
                android:text="Rate"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <TextView
                android:id="@+id/eTicket"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/eTicketTitle"
                android:layout_alignStart="@id/eTicketTitle"
                android:layout_alignTop="@id/eTicketTitle"
                android:layout_marginTop="15dp"
                android:text="Yes"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <!-- Counter List Button-->

            <Button
                android:id="@+id/counterListButton"
                style="?android:attr/borderlessButtonStyle"
                android:layout_width="match_parent"
                android:layout_height="32dp"
                android:layout_below="@id/busRating"
                android:layout_centerHorizontal="true"
                android:layout_marginLeft="45dp"
                android:layout_marginRight="45dp"
                android:layout_marginTop="35dp"
                android:background="#00D463"
                android:paddingLeft="22dp"
                android:paddingRight="22dp"
                android:text="Counter List"
                android:textAllCaps="false"
                android:textColor="#FFF"
                android:textSize="15sp" />


            <ImageView
                android:id="@+id/firstImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/counterListButton"
                android:layout_marginRight="18dp"
                android:layout_marginTop="20dp"
                android:layout_toLeftOf="@+id/secondImage"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />

            <ImageView
                android:id="@+id/secondImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/counterListButton"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="20dp"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />

            <ImageView
                android:id="@+id/thirdImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/counterListButton"
                android:layout_marginLeft="18dp"
                android:layout_marginTop="20dp"
                android:layout_toRightOf="@+id/secondImage"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />


            <ImageView
                android:id="@+id/fourthImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/firstImage"
                android:layout_marginRight="18dp"
                android:layout_marginTop="18dp"
                android:layout_toLeftOf="@+id/fifthImage"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />

            <ImageView
                android:id="@+id/fifthImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/firstImage"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="18dp"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />

            <ImageView
                android:id="@+id/sixthImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/firstImage"
                android:layout_marginLeft="18dp"
                android:layout_marginTop="18dp"
                android:layout_toRightOf="@+id/fifthImage"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />

        </RelativeLayout>
    </ScrollView>

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@android:color/transparent"
        android:elevation="0.5dp">

        <TextView
            android:id="@+id/toolbarText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="About Desh Travel"
            android:textColor="#ffffff"
            android:textSize="20sp"
            android:visibility="invisible" />
    </android.support.v7.widget.Toolbar>

</RelativeLayout>
工具栏
布局置于
滚动视图
下方

试试这个:

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


    <ScrollView
        android:id="@+id/busInformationActivityScrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#FFFFFF"
            android:paddingBottom="20dp">

            <!-- Image for the bus cover-->
            <ImageView
                android:id="@+id/busCover"
                android:layout_width="match_parent"
                android:layout_height="198dp"
                android:contentDescription="Cover for the Bus"
                android:scaleType="fitXY" />

            <!-- Layout for the Bus name and the rating-->

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignBottom="@+id/busCover"
                android:background="#28000000"
                android:padding="7dp">

                <TextView
                    android:id="@+id/busName"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="12dp"
                    android:layout_marginStart="12dp"
                    android:text="Desh Travels"
                    android:textColor="#FFF"
                    android:textSize="20sp" />

                <com.iarcuschin.simpleratingbar.SimpleRatingBar
                    android:id="@+id/ratingBar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="end|center_vertical"
                    android:layout_marginEnd="12dp"
                    android:layout_marginRight="12dp"
                    android:visibility="gone"
                    app:srb_borderColor="#f1bc0e"
                    app:srb_fillColor="#e5e917"
                    app:srb_numberOfStars="5"
                    app:srb_rating="3"
                    app:srb_starBackgroundColor="#f7f9d8"
                    app:srb_starBorderWidth="0.5"
                    app:srb_starSize="15dp"
                    app:srb_starsSeparation="2dp"
                    app:srb_stepSize="1" />

            </FrameLayout>

            <!-- Description of the bus-->

            <TextView
                android:id="@+id/busDescription"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/busCover"
                android:layout_marginTop="2dp"
                android:gravity="start"
                android:padding="20dp"
                android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus non turpis quam. Sed at sagittis felis. Maecenas blandit vestibulum lorem, quis efficitur diam tempus in."
                android:textColor="#3E3E3E"
                android:textSize="12.5sp" />

            <!--Separator-->

            <View
                android:id="@+id/viewSeparator"
                android:layout_width="match_parent"
                android:layout_height="0.5dp"
                android:layout_below="@+id/busDescription"
                android:layout_marginLeft="55dp"
                android:layout_marginRight="55dp"
                android:layout_marginTop="5dp" />

            <!-- Info of the bus-->

            <!-- 1st Para-->
            <TextView
                android:id="@+id/launchedTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_below="@+id/viewSeparator"
                android:layout_marginLeft="20dp"
                android:layout_marginStart="20dp"
                android:text="Launched"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <TextView
                android:id="@+id/totalBusTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/viewSeparator"
                android:layout_centerHorizontal="true"
                android:layout_marginLeft="90dp"
                android:layout_marginStart="90dp"
                android:text="Total Bus"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <TextView
                android:id="@+id/acBusTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_alignParentRight="true"
                android:layout_below="@+id/viewSeparator"
                android:layout_marginEnd="20dp"
                android:layout_marginRight="20dp"
                android:text="AC Bus"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <!--1st Info Para-->

            <TextView
                android:id="@+id/launched"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/launchedTitle"
                android:layout_alignStart="@id/launchedTitle"
                android:layout_alignTop="@id/launchedTitle"
                android:layout_marginTop="15dp"
                android:text="2009"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <TextView
                android:id="@+id/totalBus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/totalBusTitle"
                android:layout_alignStart="@id/totalBusTitle"
                android:layout_alignTop="@id/totalBusTitle"
                android:layout_marginTop="15dp"
                android:text="50"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <TextView
                android:id="@+id/acBus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/acBusTitle"
                android:layout_alignStart="@id/acBusTitle"
                android:layout_alignTop="@id/acBusTitle"
                android:layout_marginTop="15dp"
                android:text="24"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <!-- 2nd Para-->

            <TextView
                android:id="@+id/nonACBusTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/launched"
                android:layout_alignStart="@id/launched"
                android:layout_alignTop="@id/launched"
                android:layout_marginTop="25dp"
                android:text="Non AC Bus"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <TextView
                android:id="@+id/busRatingTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/totalBus"
                android:layout_alignStart="@id/totalBus"
                android:layout_alignTop="@id/totalBus"
                android:layout_marginTop="25dp"
                android:text="Rating"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <TextView
                android:id="@+id/eTicketTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/acBus"
                android:layout_alignStart="@id/acBus"
                android:layout_alignTop="@id/acBus"
                android:layout_marginTop="25dp"
                android:text="eTicket"
                android:textColor="#01AA4F"
                android:textSize="13.5sp" />

            <!-- 2nd Info Para-->

            <TextView
                android:id="@+id/nonACBus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/nonACBusTitle"
                android:layout_alignStart="@id/nonACBusTitle"
                android:layout_alignTop="@id/nonACBusTitle"
                android:layout_marginTop="15dp"
                android:text="26"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <TextView
                android:id="@+id/busRating"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/busRatingTitle"
                android:layout_alignStart="@id/busRatingTitle"
                android:layout_alignTop="@id/busRatingTitle"
                android:layout_marginTop="15dp"
                android:text="Rate"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <TextView
                android:id="@+id/eTicket"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/eTicketTitle"
                android:layout_alignStart="@id/eTicketTitle"
                android:layout_alignTop="@id/eTicketTitle"
                android:layout_marginTop="15dp"
                android:text="Yes"
                android:textColor="#000000"
                android:textSize="12.5sp" />

            <!-- Counter List Button-->

            <Button
                android:id="@+id/counterListButton"
                style="?android:attr/borderlessButtonStyle"
                android:layout_width="match_parent"
                android:layout_height="32dp"
                android:layout_below="@id/busRating"
                android:layout_centerHorizontal="true"
                android:layout_marginLeft="45dp"
                android:layout_marginRight="45dp"
                android:layout_marginTop="35dp"
                android:background="#00D463"
                android:paddingLeft="22dp"
                android:paddingRight="22dp"
                android:text="Counter List"
                android:textAllCaps="false"
                android:textColor="#FFF"
                android:textSize="15sp" />


            <ImageView
                android:id="@+id/firstImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/counterListButton"
                android:layout_marginRight="18dp"
                android:layout_marginTop="20dp"
                android:layout_toLeftOf="@+id/secondImage"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />

            <ImageView
                android:id="@+id/secondImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/counterListButton"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="20dp"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />

            <ImageView
                android:id="@+id/thirdImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/counterListButton"
                android:layout_marginLeft="18dp"
                android:layout_marginTop="20dp"
                android:layout_toRightOf="@+id/secondImage"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />


            <ImageView
                android:id="@+id/fourthImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/firstImage"
                android:layout_marginRight="18dp"
                android:layout_marginTop="18dp"
                android:layout_toLeftOf="@+id/fifthImage"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />

            <ImageView
                android:id="@+id/fifthImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/firstImage"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="18dp"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />

            <ImageView
                android:id="@+id/sixthImage"
                android:layout_width="100dp"
                android:layout_height="80dp"
                android:layout_below="@+id/firstImage"
                android:layout_marginLeft="18dp"
                android:layout_marginTop="18dp"
                android:layout_toRightOf="@+id/fifthImage"
                android:scaleType="centerCrop"
                android:src="@drawable/placeholder" />

        </RelativeLayout>
    </ScrollView>

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@android:color/transparent"
        android:elevation="0.5dp">

        <TextView
            android:id="@+id/toolbarText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="About Desh Travel"
            android:textColor="#ffffff"
            android:textSize="20sp"
            android:visibility="invisible" />
    </android.support.v7.widget.Toolbar>

</RelativeLayout>


希望这会有所帮助~

我建议使用线性布局作为主布局,其中方向=垂直将解决您的问题。请尝试在布局中为滚动视图添加
fillviewport=“true”
xml@Er.TysonSubba,我不想使用线性布局,因为这样会使滚动视图位于工具栏下方,但我希望工具栏在顶部,滚动视图在后面it@rafsanahmad007这没有帮助:(根据您的图片帖子,您需要根据您的要求使用折叠工具栏布局。这将使工具栏下方的滚动视图成为我不想要的,这是我想要的,这是我在下面设置布局时得到的,然后您想要什么?。您还没有澄清事实上没有,我只是希望工具栏保持在顶部,我使用一个onScrollListener来更改工具栏的颜色。Ferdous Ahamed的答案解决了这一问题,这将使工具栏下方的滚动视图成为我不想要的,这是我想要的,这是我在下面设置布局时得到的。如果我的答案似乎有用,别忘了放弃投票。阅读