2015-04-01 33 views
1

我如何在一個活動中有多個圖形? (MPAndroidChart)嗨,我如何可以在活動中有多個圖形? (MPAndroidChart)

我嘗試將多個圖形,但第二替換第一:C

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

<com.github.mikephil.charting.charts.LineChart 
    android:id="@+id/estado_total_grafica_Humedad" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" /> 
+0

好吧,如果您不發佈所有信息,則無法在此處獲得答案。 xml中的周圍佈局是什麼? – Bondax 2015-04-01 07:49:08

+0

在aChartEngine中你可以。 – 2015-04-01 08:35:02

回答

0

這不是關於圖表庫的問題。 看來你還沒有正確理解xml中的android-layout是如何工作的。

我強烈建議您閱讀android developer layout guidelines

至於上面的簡單的例子,嘗試以下方法:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <com.github.mikephil.charting.charts.LineChart 
    android:id="@+id/estado_total_grafica_Temperatura" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="1" /> 

    <com.github.mikephil.charting.charts.LineChart 
    android:id="@+id/estado_total_grafica_Humedad" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="1" /> 

</LinearLayout> 

這將會把圖表中的線性佈局垂直,使用weight屬性。

相關問題