我在查看我的应用程序时收到此错误。
"布局编辑器中的图形预览可能不准确:
不支持 Path.isConvex。 (忽略此 session )”
看错误图片:
这是 activity_main.xml 中的小部件
<ImageButton
android:id="@+id/ImageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/RoomEditText"
android:layout_centerHorizontal="true"
android:layout_marginTop="48dp"
android:background="@drawable/button_go"
android:minHeight="40dp"
android:minWidth="256dp" />
<EditText
android:id="@+id/RoomEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/ImageButton1"
android:layout_below="@+id/imageView1"
android:layout_marginTop="80dp"
android:background="@drawable/editbox_round"
android:ems="10"
android:gravity="center_vertical|center_horizontal"
android:inputType="text"
android:maxLength="15"
android:minHeight="32dp"
android:minWidth="256dp" />
以下是可绘制对象:
button_go.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="90"
android:endColor="#cc1a22"
android:startColor="#550200" />
<corners
android:bottomLeftRadius="15dp"
android:bottomRightRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp" >
</corners>
</shape>
editbox_round.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#ffffff" />
<stroke
android:width="1dp"
android:color="#000000"
/>
<corners
android:topLeftRadius="10dp"
android:topRightRadius="10dp"
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
/>
</shape>
我不太清楚为什么它们会隐形。如果有人愿意告诉我这里到底发生了什么?
最佳答案
你得到“Path.isConvex is not supported”错误,因为你分别得到了每个角的半径值。你必须使用
<corners android:radius="10dip" />
代替
<corners
android:topLeftRadius="10dp"
android:topRightRadius="10dp"
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
/>
关于java - 自定义按钮/编辑框不可见?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26199929/