2016-10-12 5 views
0

私は完璧に動作しているPieChartを持っています。しかし、PieChartの下には、EditText、Texviews、Buttonsなどのコンテンツが必要です。私は、ユーザーが下にスクロールして別のコンテンツを見ることができるようにしたい。 私はLinearLayoutの内部にRelativeLayoutを持っていますが、向きは垂直ですが何も表示されません。MpAndroidChartの下にコンテンツを追加するには?

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

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

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


      </RelativeLayout> 

      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Click me" 
      /> 

    </LinearLayout> 

答えて

1

ScrollViewの下であなたのLinearLayoutを入れてください。それは動作するはずです。

グラフでは、高さをwrap_contentにしてください。

それは次のようになります。

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

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

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

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

    </RelativeLayout> 

    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Click me" 
    /> 

    </LinearLayout>  

</ScrollView> 
関連する問題