如何在android中操作mpandroid图表时停止使用scrollview

问题描述 投票:0回答:1
<ScrollView
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginStart="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginRight="8dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/imageView5">

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

            <TextView
                android:id="@+id/textView9"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="KMS"
                android:textColor="@color/oren"
                android:textSize="18sp"
                android:textStyle="bold" />

            <com.github.mikephil.charting.charts.LineChart
                android:id="@+id/lcKMS"
                android:layout_width="match_parent"
                android:layout_height="300dp">

            </com.github.mikephil.charting.charts.LineChart>
       </LinearLayout>
    </ScrollView>

我在滚动视图中有mpandroid图表,但由于将其与滚动视图中的滚动功能混合使用,因此缩放图表有点困难。

android xml scroll mpandroidchart android-scrollview
1个回答
0
投票

请不要使用ScrollView。

阅读此内容可修改视口并“使图表变宽”:https://github.com/PhilJay/MPAndroidChart/wiki/Modifying-the-Viewport

也可以在滚动时显示。

© www.soinside.com 2019 - 2024. All rights reserved.