简体   繁体   English

ScrollView 中 ConstraintLayout 的问题

[英]Problem for ConstraintLayout inside a ScrollView

I have many buttons inside the app, and want to scrooll just buttons but, I can't use a ScrollView just for buttons,Is it possible?我在应用程序中有很多按钮,并且只想滚动按钮,但是,我不能仅将 ScrollView 用于按钮,这可能吗?

    <?xml version="1.0" encoding="utf-8"?>
    <ScrollView  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=".ui.motor.MotorFragment">
   <androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="wrap_content"
    android:layout_height="400dp">

  <VideoView
    android:id="@+id/Motorvid"
    android:layout_width="wrap_content"
    android:layout_height="700dp"
    android:layout_marginBottom="700dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    tools:ignore="MissingConstraints" />

There is many buttons here to scrooll:这里有很多按钮可以滚动:

  <Button
    style="@style/AppTheme.RoundedCornerMaterialButton"
    android:layout_width="0dp"
    android:id="@+id/bmotor1"
    android:layout_height="wrap_content"
    android:layout_marginStart="20dp"
    android:layout_marginLeft="20dp"
    android:layout_marginTop="380dp"
    android:layout_marginEnd="20dp"
    android:layout_marginRight="20dp"
    android:text="Genel Tanıtım"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    tools:ignore="Suspicious0dp" />



 </androidx.constraintlayout.widget.ConstraintLayout>
 </ScrollView>

I think one solution would be just put your buttons in LinearLayout and wrap it with ScrollView not everything with ScrollView.我认为一种解决方案是将您的按钮放在 LinearLayout 中并用 ScrollView 包装它,而不是用 ScrollView 包装所有东西。 If my answer is not what you want could you provide more information?如果我的回答不是您想要的,您能否提供更多信息? Like images of what you doing and how finished result should work.就像你在做什么以及完成的结果应该如何工作的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM