有没有办法为LinearLayout或其他View设置边框纹理?我无法仅设置图像作为背景,因为不同屏幕大小会导致问题。这是我所说的纹理的样本: https://istack.dev59.com/PkaYt.webp。我尝试使用Nine-Patch,但它会拉伸应该重复的白线。来自Draw 9-patch工具的截图: https://istack.dev59.com/ApqYo.webp。
shape
drawable:<shape android:shape="rectangle">
<solid android:color="#FAFAD2" />
<stroke android:width="1sp" android:color="#000000"
android:dashWidth="7sp" android:dashGap="5sp" />
</shape>
这将会得到类似于这样的结果:
您可以根据自己的需求更改颜色、宽度、边框等。
<solid android:color="#00000000" />
,它起作用了。谢谢。在这里找到了答案 - https://dev59.com/zG035IYBdhLWcg3wErrM - Roman