约束布局中的滚动条不起作用

泽山阿里

我已经尝试了下面的代码,但是当我旋转我的应用程序时它不会滚动它会覆盖大部分屏幕但我需要在那里滚动它在那里不起作用。在约束布局中使用滚动视图是正确的方法吗?我见过这种类型的例子。在那里它处于工作状态我已经尝试了下面的代码但是当我旋转我的应用程序时它不会滚动它会覆盖大部分屏幕但我需要在那里滚动它在那里不起作用。在约束布局中使用滚动视图是正确的方法吗?我见过这种类型的例子。

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

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

<ScrollView
    android:id="@+id/scrollView2"
    android:layout_width="match_parent"
    android:layout_height="611dp"
    android:layout_marginTop="70dp"
    android:scrollbars="none"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.0"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="0dp"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:weightSum="2">

            <ImageView
                android:id="@+id/main_bmi"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/bmi" />

            <ImageView
                android:id="@+id/bmr"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/bmr" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:orientation="horizontal"
            android:weightSum="2">

            <ImageView
                android:id="@+id/ideal_weight"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/ideal" />

            <ImageView
                android:id="@+id/water_intake"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/water" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:orientation="horizontal"
            android:weightSum="2">

            <ImageView
                android:id="@+id/calorie"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/calories" />

            <ImageView
                android:id="@+id/nutrition"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/nutrition" />
        </LinearLayout>
    </LinearLayout>

</ScrollView>

</android.support.constraint.ConstraintLayout>
黑曼巴

按照这一层它可能会工作。将 appbarlayout 放在 ConstraintLayout 布局中

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <!--add your scrollview or nestedscrollview here-->


    </LinearLayout>
</android.support.design.widget.AppBarLayout>

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

extjs 5网格的滚动条在边框布局面板中不起作用

来自分类Dev

scrollarea中的滚动条不起作用

来自分类Dev

滚动条在Java中不起作用

来自分类Dev

隐藏滚动条在 Mozilla Firefox 中不起作用

来自分类Dev

jQuery滚动条不起作用

来自分类Dev

咒语滚动条不起作用

来自分类Dev

Tkinter滚动条不起作用

来自分类Dev

滚动条在 chrome 中不起作用,但在 Firefox 中起作用

来自分类Dev

完美的滚动条不起作用

来自分类Dev

高图滚动条不起作用

来自分类Dev

滚动条在JPane内的JScrollPanel上不起作用

来自分类Dev

为什么我的Tkinter滚动条不起作用?

来自分类Dev

水平滚动条不起作用asp.net

来自分类Dev

Python Tkinter滚动条不起作用

来自分类Dev

从idiotWu反应光滑的滚动条不起作用?

来自分类Dev

tkinter:滚动条出现但不起作用

来自分类Dev

为什么我的div滚动条不起作用?

来自分类Dev

滚动条不起作用 - Selenium Webdriver

来自分类Dev

滚动条上的锚点突出显示在Firefox中不起作用

来自分类Dev

Chrome和Safari滚动条在Firefox中不起作用

来自分类Dev

模式上的滚动条在 Firefox 和 IE 中不起作用

来自分类Dev

ASP.NET Gridview固定标题可滚动滚动条不起作用

来自分类Dev

AS3滚动条,与约束布局的奇怪交互?

来自分类Dev

具有自定义滚动条的jQuery选择框(roblaplaca)不起作用

来自分类Dev

当我在jscrollpane上添加jtable时,水平滚动条不起作用

来自分类Dev

ItemsControl [视图]滚动条在由BindableCollection填充时不起作用

来自分类Dev

添加垂直滚动条并更改其颜色不起作用

来自分类Dev

组碰撞在Pygame的平台滚动条上不起作用

来自分类Dev

角材料自定义滚动条不起作用

Related 相关文章

热门标签

归档