Android PNG背景透明图像
我在更改按钮背景图像时遇到问题。 所以我有 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。 当我单击单元格时,行为是正确的(显示发光),但图像的一角(假设是透明的)也会显示黄色。我该如何解决这个问题? 谢谢
I have a problem with changing button background image.
So i have 2 images (png-24 transparent background).
Images are a simple circle and the same circle but with some outerglow ).
I have the following code
<?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>
And the 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>
The LinearLayout is used to populate a GridView in each cell.
When i click the cell the behavior is correct (the glow is displayed) but also a yellow color is display on the corner of the image (where suppose to be transparent). How can i fix that?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要添加
到 GridView 声明中。
看看这个:
Android:禁用 GridView 中的突出显示
You need to add
to your GridView declaration.
See this:
Android: Disable highlighting in GridView