如何向位图添加边距顶部?

问题描述 投票:1回答:1

这是可绘制文件:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
  <item>
    <color android:color="#ffffffff"/>
  </item>
  <item>
    <bitmap android:gravity="top|center_horizontal"
            android:src="@drawable/splash_screen"/>
  </item>
</layer-list>

我希望位图具有20px的margin-top,我没有找到如何将margin-top设置为bitmaps元素

android android-studio android-layout android-bitmap android-gravity
1个回答
1
投票

您可以尝试使用android:top

顶部偏移量(以像素为单位。)>

android:top
© www.soinside.com 2019 - 2024. All rights reserved.