【问题标题】:How to set vector background on a Bottom Sheet Dialog如何在底页对话框上设置矢量背景
【发布时间】:2020-01-11 22:33:41
【问题描述】:

有没有办法将BottomSheetDialogFragment的背景设置为Vector?简单地设置android:background="@drawable/vector" 不起作用。

vector.xml

<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
    android:viewportWidth="1123"
    android:viewportHeight="1785"
    android:width="1123dp"
    android:height="1785dp">
    <group
        android:translateY="-651">
        <path
            android:pathData="M48.0035499 652.223154L1089.36686 820.119125C1108.75028 823.244256 1123 839.975434 1123 859.609162L1123 2436L1123 2436L-3 2436L-3 695.662195C-3 671.361666 16.699471 651.662195 41 651.662195C43.3457374 651.662195 45.6877185 651.849779 48.0035499 652.223154Z"
            android:fillType="evenOdd"
            android:fillColor="#FFFFFF" />
    </group>
</vector>

【问题讨论】:

    标签: android android-layout android-xml


    【解决方案1】:

    考虑到,您已将android:background="@drawable/vector" 添加到布局的根视图中。检查是否有任何子视图占用了父尺寸并将背景设置为白色。在这种情况下,您的 rootview 将无法显示您的确切形状。

    请提供您的布局文件作为参考,以防这不是问题。

    【讨论】:

      猜你喜欢
      • 2023-03-29
      • 2023-03-23
      • 2015-09-04
      • 1970-01-01
      • 2018-01-29
      • 1970-01-01
      • 1970-01-01
      • 2013-03-09
      • 1970-01-01
      相关资源
      最近更新 更多