Reputation: 2247
I add a pie chart on my android application and it worked perfectly, but, despite the layout was defined to "match_parent", it got really small, I couldn't even read it.
I found a answer here on StackOverflow that says to put the chart as the content (setContentView(pieChart)) and it worked, but I want to add more elements below the chart so it can't be set as the content.
What should I do?
Upvotes: 0
Views: 4340
Reputation: 1004
Here is a layout I used which fixed my issue:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<com.github.mikephil.charting.charts.PieChart
android:id="@+id/piechart"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:layout_weight="1">
</com.github.mikephil.charting.charts.PieChart>
... other things ...
</LinearLayout>
Upvotes: 1