有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java矢量图像被拉伸

我需要做一个这样的布局:

enter image description here

我使用vector(dialog.xml):

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
    安卓:width="692.6dp"
    安卓:height="312.4dp"
    安卓:viewportWidth="692.6"
    安卓:viewportHeight="312.4">

    <path
        安卓:fillColor="#FFFFFF"
        安卓:pathData="M 1.2 1.1 H 692.5 V 285.1 H 1.2 V 1.1 Z" />
    <path
        安卓:fillColor="#FFFFFF"
        安卓:pathData="M 595.9 285.1 L 623.6 285.1 L 596 312.8 L 568.1 285.1 Z" />
</vector>

然后:

<RelativeLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
        安卓:layout_width="match_parent"
        安卓:layout_height="match_parent"
        安卓:clipChildren="false"
        安卓:layout_alignParentTop="true"
        安卓:layout_alignParentLeft="true"
        安卓:layout_alignParentStart="true"
        安卓:layout_margin="10dp">

        <View
            安卓:layout_width="fill_parent"
            安卓:layout_height="400dp"
            安卓:rotation="100"
            安卓:background="@drawable/dialog"
            安卓:layout_alignParentTop="true"
            安卓:layout_centerHorizontal="true"
            安卓:layout_alignParentStart="true" />

        <TextView
            安卓:layout_width="match_parent"
            安卓:layout_height="wrap_content"
            安卓:text="Test"
            安卓:layout_margin="20dp"
            安卓:textSize="25pt"/>

    </RelativeLayout>

但是图像被拉伸了,看起来不太好。此外,vector需要API级别21,我的应用程序最小API是15。我怎样才能用另一种方式制作这个表单的布局


共 (0) 个答案