2016-10-12 3 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

LinearLayoutScrollView 아래에 넣습니다. 그것은 작동해야합니다.

차트에서 높이를 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> 
관련 문제