防止矢量图像变形

时间:2019-04-15 19:20:48

标签: android android-layout android-vectordrawable

我有一个矢量图像作为动作条的背景,我的问题是,当该条改变大小时,矢量会变形并且动画看起来不自然。有办法防止这种情况吗?

enter image description here

这是向量“ bar_left_angle”:

  <vector android:height="24dp" android:viewportHeight="51"
        android:viewportWidth="173" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
        <path android:fillColor="#1B5E20" android:pathData="M173.859,0l0,27.274l-147.496,24.278l-26.363,-29.307l0,-22.245"/>
    </vector>

这里是布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/grey"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/productsBarLayout"
        android:layout_width="match_parent"
        android:layout_height="192dp"
        android:fitsSystemWindows="true"
        android:scaleType="fitXY"
        android:background="@drawable/bar_left_angle"
        app:elevation="0dp" >
        <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed" >
            <android.support.v7.widget.Toolbar
                android:layout_height="?attr/actionBarSize"
                android:layout_width="match_parent"
                android:background="@drawable/bar_left_angle"
                app:layout_collapseMode="pin"/>
        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

</android.support.design.widget.CoordinatorLayout>

0 个答案:

没有答案