我想在seekbar
下方插入一个图表,在seekbar
之后,我希望该页面可滚动,我该怎么做?我尝试在seekbar
下方插入图表,但由于所有限制,整个设计都搞砸了。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<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:id="@+id/constraintlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context="marcusleeeugene.dronebrightnessremote.MainActivity">
<RelativeLayout
android:id="@+id/relative"
android:layout_width="0dp"
android:layout_height="551dp"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="83dp">
</RelativeLayout>
<Button
android:id="@+id/button"
android:layout_width="220dp"
android:layout_height="56dp"
android:layout_marginBottom="141dp"
android:onClick="disconnectfromserver"
android:text="Disconnect"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:layout_constraintBottom_creator="1"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1" />
<TextView
android:id="@+id/tblumens"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="24000 Lumens"
android:textSize="40sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.433"
tools:ignore="HardcodedText"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1" />
<SeekBar
android:id="@+id/seekbarbrightness"
style="@style/Widget.AppCompat.SeekBar"
android:layout_width="0dp"
android:layout_height="31dp"
android:layout_marginEnd="25dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginStart="25dp"
android:max="100"
android:progress="0"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:layout_constraintBottom_creator="1"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
android:layout_marginBottom="68dp" />
<TextView
android:id="@+id/tbvolts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="Voltage: 50.0V"
android:textSize="30sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintTop_creator="1" />
<TextView
android:id="@+id/tbamps"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="20dp"
android:text="Amperes: 60.0A"
android:textSize="30sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tbvolts"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintTop_creator="1" />
<RatingBar
android:id="@+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="21dp"
android:isIndicator="true"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tblumens"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1" />
<Button
android:id="@+id/btngraph"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:text="Graph"
app:layout_constraintBottom_toTopOf="@+id/tblumens"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:layout_constraintBottom_creator="1"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1" />
</android.support.constraint.ConstraintLayout>
</ScrollView>
这是我的图表视图:
<com.jjoe64.graphview.GraphView
android:id="@+id/voltagegraph"
android:layout_width="match_parent"
android:layout_height="230dp"
android:layout_marginTop="30dp" />
我的设计目前如何:
我需要图表低于seekbar
,我可以滚动到这里。
答案 0 :(得分:0)
如果你的根布局是一个scrollView,那么整个页面都会滚动
方式布局中是否存在空的relativelayout?
获取您想要的更改根布局以限制布局并在其中移动滚动视图所需的内容,然后您想要滚动的所有内容都需要在其内部