当设备为横向时,我为 UI 屏幕设置了一个垂直滚动条。滚动条位于屏幕的最右侧,从屏幕顶部一直延伸到底部,包括屏幕顶部的传统工具栏。我希望滚动条仅从工具栏下方的布局运行到屏幕底部。我在工具栏代码下方的 LinearLayout 上设置了样式,但它没有按我的预期工作。请指教。
部分主题.xml:
...
<style name="scrollbar_shape_style">
<item name="android:scrollbars">vertical</item>
<item name="android:scrollbarThumbVertical">@drawable/scrollbar_vertical_thumb</item>
<item name="android:scrollbarSize">@dimen/custom_scroll_width</item>
</style>
...
部分土地\layout.xml:
...
<?xml version="1.0" encoding="utf-8"?>
<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="match_parent"
android:fillViewport="true"
android:background="#FFFFFF"
android:focusableInTouchMode="true"
tools:context=".CardViewActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" >
</include>
<LinearLayout
android:id="@+id/GridLayout1"
style="@style/scrollbar_shape_style"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/rounded_corner"
android:layout_marginLeft="6dp"
android:layout_marginStart="6dp"
android:layout_marginRight="6dp"
android:layout_marginEnd="6dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:useDefaultMargins="false"
android:orientation="vertical"
android:paddingRight="2dp"
android:paddingEnd="2dp"
android:paddingLeft="0dp"
android:paddingStart="0dp" >
...
</LinearLayout>
</LinearLayout>
</ScrollView>