web-dev-qa-db-ja.com

android)のツールバーの下にあるスクロールビュー

Androidのツールバーの下にスクロールバーを設定することは可能ですか?レイアウトにツールバーが添付されているscrollbarViewを次のように試しています。

<ScrollView xmlns:Android="http://schemas.Android.com/apk/res/Android"
    xmlns:tools="http://schemas.Android.com/tools"
    Android:orientation="vertical"
    Android:layout_width="match_parent"
    Android:layout_height="wrap_content">

    <LinearLayout
        xmlns:Android="http://schemas.Android.com/apk/res/Android"
        xmlns:tools="http://schemas.Android.com/tools"
        Android:layout_width="match_parent"
        Android:layout_height="match_parent"
        Android:background="@color/layoutcolor_background"
        Android:orientation="vertical"
        tools:ignore="ContentDescription,RtlHardcoded,NestedWeights">

        <include
            Android:id="@+id/toolbar"
            layout="@layout/main_toolbar" />

        <View
            Android:layout_width="match_parent"
            Android:layout_height="5dp"
            Android:background="@drawable/toolbar_dropshadow" />

        <LinearLayout
            Android:id="@+id/aandcID"
            Android:layout_width="match_parent"
            Android:layout_height="wrap_content"
            Android:layout_marginLeft="2dp"
            Android:layout_marginRight="2dp"
            Android:layout_weight=".50"
            Android:baselineAligned="false"
            Android:orientation="horizontal">

            <RelativeLayout
                Android:id="@+id/alayout"
                Android:layout_width="0dp"
                Android:layout_height="match_parent"
                Android:layout_margin="1dp"
                Android:layout_weight=".50"
                Android:background="@color/layoutbackgroudforrow"
                Android:gravity="center">

                <ImageView
                    Android:id="@+id/aimage"
                    Android:layout_width="100dp"
                    Android:layout_height="100dp"
                    Android:layout_centerHorizontal="true"
                    Android:paddingBottom="3dp"
                    Android:paddingTop="5dp"
                    Android:src="@drawable/acc" />

                <TextView
                    Android:id="@+id/aType"
                    Android:layout_width="wrap_content"
                    Android:layout_height="wrap_content"
                    Android:layout_below="@+id/aimage"
                    Android:layout_centerHorizontal="true"
                    Android:layout_marginTop="5dp"
                    Android:ellipsize="end"
                    Android:gravity="center"
                    Android:paddingLeft="2dp"
                    Android:singleLine="true"
                    Android:text="Deposit"
                    Android:textColor="@color/blackText"
                    Android:textSize="18sp"
                    Android:textStyle="bold"
                    tools:ignore="RtlSymmetry,RtlHardcoded,HardcodedText" />

                <TextView
                    Android:id="@+id/anumber"
                    Android:layout_width="wrap_content"
                    Android:layout_height="wrap_content"
                    Android:layout_below="@+id/aType"
                    Android:layout_centerHorizontal="true"
                    Android:layout_marginTop="5dp"
                    Android:ellipsize="end"
                    Android:gravity="center"
                    Android:paddingLeft="2dp"
                    Android:singleLine="true"
                    Android:text="12345678901234567890"
                    Android:textColor="@color/blackText"
                    Android:textSize="18sp"
                    tools:ignore="RtlSymmetry,RtlHardcoded,HardcodedText" />

                <ImageView
                    Android:id="@+id/rupeeIcon"
                    Android:layout_width="12dp"
                    Android:layout_height="14dp"
                    Android:layout_below="@+id/anumber"
                    Android:layout_centerHorizontal="true"
                    Android:layout_marginTop="8dp"
                    Android:layout_toLeftOf="@+id/accatext"
                    Android:background="@drawable/rupees_symbol"
                    Android:paddingBottom="2dp"
                    Android:visibility="visible"
                    tools:ignore="ContentDescription" />

                <TextView
                    Android:id="@+id/accatext"
                    Android:layout_width="wrap_content"
                    Android:layout_height="wrap_content"
                    Android:layout_below="@+id/anumber"
                    Android:layout_centerHorizontal="true"
                    Android:layout_marginTop="5dp"
                    Android:ellipsize="end"
                    Android:gravity="center"
                    Android:paddingLeft="2dp"
                    Android:singleLine="true"
                    Android:text="09876543210987654321"
                    Android:textColor="@color/numbertext"
                    Android:textSize="16sp"
                    tools:ignore="RtlSymmetry,RtlHardcoded,HardcodedText" />
            </RelativeLayout>
        </LinearLayout>

        <ImageView
            Android:layout_width="match_parent"
            Android:layout_height="wrap_content"
            Android:background="@drawable/footer_band" />

    </LinearLayout>
</ScrollView>

上記のコードでは..ツールバーもスクロールされるため、切り取られます。ツールバーをフリーズしてから他のビューをスクロールする方法はありますか?.

誰かが私を案内してくれたら素晴らしいと思いますか?

ありがとう!

11
user5287166

このようなことをするだけです

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

    <include layout="@layout/toolbar" />

    <ScrollView
        Android:layout_width="match_parent"
        Android:layout_height="match_parent">

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

           <!-- Rest of your content -->

        </LinearLayout>

    </ScrollView>

</LinearLayout>
16
Jin

ツールバーをScrollViewの上に置き、次に、layout_belowパラメーターをScrollViewに追加して追加し、ツールバーの下に表示されるようにします。

それは間違いなく機能します。

<RelativeLayout
    xmlns:Android = "http://schemas.Android.com/apk/res/Android"
    xmlns:app = "http://schemas.Android.com/apk/res-auto"
    xmlns:ads = "http://schemas.Android.com/apk/res-auto"
    xmlns:tools = "http://schemas.Android.com/tools"
    Android:layout_width = "match_parent"
    Android:layout_height = "match_parent"
    app:layout_behavior = "@string/appbar_scrolling_view_behavior"
    tools:showIn = "@layout/category_layout">

    <include
        Android:id="@+id/toolbar"
        layout="@layout/tool_bar" />

    <ScrollView
        Android:layout_width="match_parent"
        Android:layout_height="match_parent"
        Android:layout_below="@+id/toolbar">

        <LinearLayout
            Android:layout_width="match_parent"
            Android:layout_height="match_parent"
            Android:orientation="vertical">
2
Akshaymahajan28