【发布时间】:2019-02-17 16:26:45
【问题描述】:
我在我的应用程序中设计了一个弹出窗口,并使用以下可绘制形状作为我的边框:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="20dp"/>
<padding android:left="20dp" android:right="20dp" android:top="10dp" android:bottom="20dp"/>
<solid android:color="@android:color/holo_green_light"/>
<stroke android:color="@android:color/black" android:width="2dp"/>
</shape>
这就是我的布局 XML 的样子:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".popChart"
android:background="@drawable/customborder"
>
<ImageView
android:id="@+id/closeIcon"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentEnd="true"
android:src="@drawable/close" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:paddingTop="30dp">
<com.github.mikephil.charting.charts.LineChart
android:id="@+id/lineC"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp" />
</RelativeLayout>
</RelativeLayout>
边框很好,但是这个可绘制背景的白角仍然可见:
由于我在这个弹出窗口后面的背景不是纯色的,所以白色的角落很突出,看起来很糟糕。有没有办法摆脱它们或使它们透明?
【问题讨论】: