我可以给一个线性布局添加边框,但是它会被画在所有的边上。我希望只将其限制在右侧,就像在CSS中一样(border-right:1px solid red;)。
我已经尝试过这个方法,但仍然会在所有的边上绘制:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<stroke
android:height="2dp"
android:width="2dp"
android:color="#FF0000" />
<solid android:color="#000000" />
<padding
android:bottom="0dp"
android:left="0dp"
android:right="1dp"
android:top="0dp" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="5dp"
android:radius="1dp"
android:topLeftRadius="5dp"
android:topRightRadius="0dp" />
</shape>
</item>
有什么建议可以完成这个需求吗?
顺便提一下,我不想使用在所需边上放置1dp宽度视图的方法。