我在我的Android应用程序上添加了一个饼图并且它工作得很好,但是,尽管布局被定义为" match_parent",它变得非常小,我甚至无法读取它。
我在StackOverflow上找到了一个答案,它说将图表作为内容(setContentView(pieChart))并且它有效,但是我想在图表下面添加更多元素,这样它就不会被设置为内容。
我该怎么办?
答案 0 :(得分:0)
这是我用来解决问题的布局:
<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>