我有一个使用setMaxAngle
创建类似仪表盘的PieChart
,但是在它下面有很多明显的空白需要去掉。我找不到修改PieChart
视口的任何方法。那么如何处理这个空白呢?请参见下面的图片。
我的布局如下:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.nextraq.anders.ui.dashboard.DashboardActivityFragment"
tools:showIn="@layout/dashboard_activity">
<android.support.v7.widget.CardView
style="@style/AndersMaterialTheme.Dashboard.Gadget"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:padding="@dimen/card_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/gadgetTitle"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/mobiles"
android:ellipsize="end"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium" />
<com.github.mikephil.charting.charts.PieChart
android:id="@+id/mobileStateChart"
android:layout_below="@id/gadgetTitle"
android:layout_width="match_parent"
android:layout_height="300dp"/>
</RelativeLayout>
</android.support.v7.widget.CardView>