我是一名有用的助手,可以为您翻译以下内容。
我有一个问题,我将一个矢量图设置为RelativeLayout的背景,但它在水平方向上没有填满屏幕。
这是我RelativeLayout的代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/my_drawable">
...
some text views etc.
...
</RelativeLayout>
如果有助于发布,以下是矢量Drawable my_drawable:
<vector android:height="24dp" android:viewportHeight="110.0"
android:viewportWidth="110.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:name="border_path" android:fillColor="@color/color_1" android:fillAlpha="1"
android:pathData="M105.13,107.51L4.89,107.51A2.38,2.38 99.69,0 1,2.51 105.13L2.51,4.89A2.38,2.38 119.37,0 1,4.89 2.51L105.13,2.51A2.38,2.38 119.37,0 1,107.51 4.89L107.51,105.13A2.38,2.38 99.69,0 1,105.13 107.51z"
android:strokeAlpha="1" android:strokeColor="@color/color_2" android:strokeWidth="5"/>
</vector>
如下截图所示,您可以看到它没有填满整个宽度。
![enter image description here](https://istack.dev59.com/PYxFT.webp)
非常感谢任何建议和解决方案!