【问题标题】:Android PNG transparent image on background背景上的Android PNG透明图像
【发布时间】:2012-02-26 04:43:47
【问题描述】:

我在更改按钮背景图像时遇到问题。 所以我有2张图片(png-24透明背景)。 图像是一个简单的圆圈和同一个圆圈,但有一些外发光)。 我有以下代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ticketing_row_topup"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@layout/pressed_topup_button"
    android:orientation="horizontal" >

<TextView
    android:id="@+id/topup_name"
    android:layout_width="60dp"
    android:layout_height="fill_parent"
    android:gravity="center_vertical|right"
    android:paddingRight="5dip"
    android:paddingTop="22dip"
    android:text="€"
    android:textColor="@color/black"
    android:textSize="35sp"
    android:textStyle="bold" />

<TextView
    android:id="@+id/topup_display_amount"
    android:layout_width="90dp"
    android:layout_height="match_parent"
    android:gravity="center_vertical|left"
    android:textSize="65sp"
    android:textColor="#0d457f"
    android:textStyle="bold" />
</LinearLayout>

还有pressed_topup_button.xml

 <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:state_enabled="false">
    <item android:state_pressed="true" android:state_enabled="true" android:drawable="@drawable/button_topup_glow" /> 
    <item android:state_focused="true" android:state_enabled="true" android:drawable="@drawable/button_topup" />
    <item android:state_enabled="true" android:drawable="@drawable/button_topup" /> 
</selector>

LinearLayout 用于在每个单元格中填充一个 GridView。 当我单击单元格时,行为是正确的(显示辉光),但图像的角落也显示黄色(假设是透明的)。我该如何解决? 谢谢

【问题讨论】:

  • 你也可以添加截图吗?

标签: android background android-linearlayout transparent


【解决方案1】:

你需要添加

 android:listSelector="@android:color/transparent"

到您的 GridView 声明。

看到这个: Android: Disable highlighting in GridView

【讨论】:

    猜你喜欢
    • 2010-12-14
    • 2023-04-01
    • 2015-07-10
    • 2023-04-10
    • 2013-12-10
    • 2014-10-05
    • 1970-01-01
    • 2015-11-12
    • 2018-02-23
    相关资源
    最近更新 更多