这是我的困境,该图形无法完全适合该卡片。我希望它看起来更好,但无法解决问题。有人可以帮忙吗?有没有更好的方法来编写代码以达到我想要的。您可能需要知道这在Scrollview中。我也不明白为什么饼图中还有多余的白色块。有办法也可以删除吗?
<android.support.v7.widget.CardView
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_marginBottom="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
app:cardCornerRadius="2dp"
app:cardElevation="3dp">
<TextView
android:id="@+id/Piechart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="ACCOUNT PIECHART"
android:textColor="@color/colorAccent" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="30dp"
android:background="#e0e0e0" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_marginTop="35dp">
<com.dharquissandas.budget.PieChart
android:id="@+id/Overall_pie"
android:layout_width="165dp"
android:layout_height="wrap_content"
android:background="@color/back_color"
android:padding="10dp"
android:pointerIcon="none"
android:visibility="visible"
app:autoCenterPointerInSlice="true"
app:highlightStrength="1.12"
app:labelColor="@android:color/black"
app:labelHeight="20dp"
app:labelPosition="left"
app:labelWidth="110dp"
app:labelY="85dp"
app:pieRotation="0"
app:pointerRadius="0dp"
app:showText="false" />
<TableLayout
android:id="@+id/Pie_legend"
android:layout_width="120dp"
android:layout_height="180dp"
android:layout_toEndOf="@+id/Overall_pie"
android:layout_marginEnd="0dp"
android:visibility="visible">
<TableRow> <ImageView
android:layout_column="1"
android:src="@color/colorPrimaryDark"
android:minWidth="15dip"
android:minHeight="15dip"
android:layout_gravity="center_vertical"
android:paddingEnd="1.5dip"
android:paddingBottom="3dip"/>
<TextView
android:text="@string/cash"
android:textColor="@color/colorPrimaryDark"
android:paddingBottom="3dip"
android:paddingStart="1.5dip"
android:textSize="18sp"/>
</TableRow>
<TableRow> <ImageView
android:layout_column="1"
android:src="@color/colorAccent"
android:minWidth="15dip"
android:minHeight="15dip"
android:paddingEnd="1.5dip"
android:paddingBottom="3dip"
android:layout_gravity="center_vertical"/>
<TextView
android:text="@string/credit_card"
android:textColor="@color/colorAccent"
android:paddingBottom="3dip"
android:paddingStart="1.5dip"
android:textSize="16sp"
/>
</TableRow>
<TableRow> <ImageView
android:layout_column="1"
android:src="@color/red"
android:minWidth="15dip"
android:minHeight="15dip"
android:paddingEnd="1.5dip"
android:paddingBottom="3dip"
android:layout_gravity="center_vertical"/>
<TextView
android:text="@string/debit_card"
android:textColor="@color/red"
android:paddingBottom="3dip"
android:paddingStart="1.5dip"
android:textSize="16sp"
/>
</TableRow>
!Some code removed but it is the same as above, look at the picture for reference!
</TableLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>