【问题标题】:Why is my imageview transparent/not showing properly?为什么我的 imageview 透明/未正确显示?
【发布时间】:2012-03-18 07:52:30
【问题描述】:

我对此感到非常困惑。我已将整个屏幕的背景颜色设置为蓝色,并且我有一个带有图像视图的框架。当我选择扑克牌可绘制作为其来源时,扑克牌的白色背景变成蓝色,图像不清晰。为什么会这样? 下面是屏幕的样子:

.

我的头像是:

:

这里是部分 XML 代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#0000FF" >

   <FrameLayout
     android:id="@+id/frameLayoutBottom"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_alignParentBottom="true"
     android:layout_centerHorizontal="true" >

         <ImageView
             android:id="@+id/ivBottom2"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"             
             android:paddingLeft="10dp"
             android:src="@drawable/c11"/>

我不想将图像的背景设置为白色,因为我正在使用填充,并且我不希望填充为白色。奇怪的是,如果我使用其他显示为红色的图像,那么它完美显示,只是当我使用扑克牌时(我有 52 张牌),它显示的是这样的 请问有什么帮助吗? 谢谢。

【问题讨论】:

    标签: android android-layout


    【解决方案1】:

    您的图像具有透明像素。使用图像编辑器将它们转换为白色。

    或者,您可以在 ImageView 上使用 specify a margin 代替 padding 和 setBackgroundColor()

    【讨论】:

      猜你喜欢
      • 2013-04-02
      • 2023-03-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-22
      • 2018-11-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多