gpt4 book ai didi

android - 如何使 3D 图像按钮透明并将图像缩放 40dp x 40dp?安卓, XML

转载 作者:行者123 更新时间:2023-11-30 02:45:24 25 4
gpt4 key购买 nike

这就是我的按钮现在的样子:

bluetooth

您可以看到按钮与背景有点不同。我希望按钮是透明的。我只想显示白色蓝牙图像。这是按钮的代码:

  <RelativeLayout 
android:id="@+id/audio_routing"
android:layout_width="40dp"
android:layout_height="40dp"
android:orientation="horizontal">
<ImageButton
android:id="@+id/audio_routing_btn"
android:contentDescription="@string/audio_routing_desc"
android:scaleType="fitXY"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/bluetooth"/>
</RelativeLayout>

按钮现在为 40dp x 40dp,但我希望蓝牙图像为 40dp x 40dp。我尝试了以下所有选项:

    android:scaleType=""

他们都没有将图像制作成 40dp x 40dp。所以两个问题,将按钮上的图像缩放到 40dp x 40dp 并使按钮透明,(我不想看到框)

这是我正在使用的蓝牙图像:

image

我使用 gimp 裁剪了白色背景。

谢谢

最佳答案

尝试此代码以获得您想要的结果:

<RelativeLayout 
android:id="@+id/audio_routing"
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="0dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/audio_routing_btn"
android:scaleType="fitXY"
android:background="#00000000"
android:contentDescription="@string/audio_routing_desc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/bluetooth"/>

</RelativeLayout>

关于android - 如何使 3D 图像按钮透明并将图像缩放 40dp x 40dp?安卓, XML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25129328/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com