Android android 个图表的可滚动屏幕
Android scrollable screen for android charts
肯定有关于这个问题的问题,但是 none 我找到的相关问题解决了我的问题。所以.
我有以下情况,我想要一个屏幕,我可以向下滚动我将拥有的倍数图表。 Like this image represents here
现在,使用下面的代码,I am getting this result。
所以,这是怎么回事,两个图表都在彼此身上,我不知道为什么。
<?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 库。
谢谢。
试试这个修改版本
<?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>
问题不清楚,你的问题到底是什么?
如果您的意思是您的图表彼此重叠,请尝试使用垂直方向的 LinearLayout 而不是第二个 RelativeLayout。
肯定有关于这个问题的问题,但是 none 我找到的相关问题解决了我的问题。所以.
我有以下情况,我想要一个屏幕,我可以向下滚动我将拥有的倍数图表。 Like this image represents here
现在,使用下面的代码,I am getting this result。
所以,这是怎么回事,两个图表都在彼此身上,我不知道为什么。
<?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 库。
谢谢。
试试这个修改版本
<?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>
问题不清楚,你的问题到底是什么? 如果您的意思是您的图表彼此重叠,请尝试使用垂直方向的 LinearLayout 而不是第二个 RelativeLayout。