我试图用OvalShape绘制自定义ShapeDrawable,填充白色和灰色边框.我创建了一个这样的drawable:
ShapeDrawable drawable = new ShapeDrawable(new OvalShape());
drawable.getPaint().setColor(Color.GRAY);
drawable.getPaint().setStyle(Style.STROKE);
drawable.getPaint().setStrokeWidth(getPixels(5));
drawable.getPaint().setAntiAlias(true);
Run Code Online (Sandbox Code Playgroud)
但结果是:角落问题

这个想法是以编程方式创建这样的形状,但具有不同的颜色:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<corners android:radius="10dip"/>
<stroke android:color="#FF0000" android:width="5dip"/>
<solid android:color="@android:color/transparent"/>
</shape>
Run Code Online (Sandbox Code Playgroud)
怎么能解决这个问题?
我正在尝试绘制部分或一侧开放的矩形圆形边框以实现此效果:
玩了一下之后我得到了这个:
这是通过以下方式完成的:
RoundedCornerShape(topStartPercent = 50, bottomStartPercent = 50) // start
RoundedCornerShape(topEndPercent = 50, bottomEndPercent = 50) // end
RectangleShape // for middle
Run Code Online (Sandbox Code Playgroud)
我想要的是删除单元格之间的垂直连接线。