简体   繁体   中英

Widget transparency broken on LG G2

I've built a contact widget for Android. It looks fine on the emulator and on my stock Nexus 4, but on my friend's G2 some backgrounds are either missing or opaque instead of translucent.

LG G2:

在此处输入图片说明

Nexus 4:

在此处输入图片说明

The background color is set as a #ARGB color from colors.xml.

I have no idea why this behavior is happening, I couldn't find anything anywhere.

I've the same issue with a widget on an LG mobile. In my case, some part of the widget become transparent every time it re-drawn (open an app, and close it)

In my layout, there is an ImageView with a drawable background:

<ImageView
  android:id="@+id/widget_next"
  android:layout_width="@dimen/widget_pager_width"
  android:layout_height="@dimen/widget_pager_height"
  android:layout_gravity="center"
  android:layout_toEndOf="@+id/widget_previous"
  android:layout_toRightOf="@+id/widget_previous"
  android:background="@drawable/widget_pager"
  android:padding="@dimen/widget_btn_padding"
  android:src="@drawable/widget_next"/>

When I've commeneted it out, the widget started work as excepted. But this was an important part of my widget, so I tried to change the attributes.

The solution:

<ImageView
  android:id="@+id/widget_next"
  android:layout_width="@dimen/widget_pager_width"
  android:layout_height="@dimen/widget_pager_height"
  android:layout_gravity="center"
  android:layout_toEndOf="@+id/widget_previous"
  android:layout_toRightOf="@+id/widget_previous"
  android:background="@color/MagnetZold_color"
  android:padding="@dimen/widget_btn_padding"
  android:src="@drawable/widget_next"/>

I've changed the background to a from a . 更改为

I don't know the reason, but it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM