0

この問題について質問があるに違いありませんが、関連することがわかった問題のどれも私の問題を解決しませんでした。そう。

次のシナリオがあります。複数のグラフを下にスクロールできる画面が必要です。この画像がここを表しているように

今のところ、以下のコードを使用すると、この結果が得られます。

つまり、何が起こっているのかというと、両方のチャートが互いに重なっているということです。その理由はわかりません。

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/mainLayout">

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/ScrollView01"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true">

        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:id="@+id/secondLayout">

            <com.github.mikephil.charting.charts.PieChart
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/pieChart" />

            <com.github.mikephil.charting.charts.BarChart
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/barChart"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_alignParentBottom="true" />

        </RelativeLayout>
    </ScrollView>

</RelativeLayout>

MPAndroidchart ライブラリを使用しています。

ありがとう。

4

2 に答える 2

1

この変更バージョンを試してください

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/mainLayout">

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ScrollView01"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true">

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/secondLayout">          


        <com.github.mikephil.charting.charts.PieChart
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="24dp"
            android:id="@+id/pieChart" />

        <com.github.mikephil.charting.charts.BarChart
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/barChart"
            android:layout_below="@+id/pieChart"              
            android:layout_marginTop="48dp"
            android:layout_centerHorizontal="true" />

    </RelativeLayout>
</ScrollView>

</RelativeLayout>
于 2016-03-03T23:56:05.047 に答える
0

質問が明確ではありません。あなたの問題は正確には何ですか? チャートが互いに重なっている場合は、2 番目の RelativeLayout の代わりに垂直方向の LinearLayout を使用してみてください。

于 2016-03-03T23:58:38.047 に答える