android - Why background drawable retain its state after activity finished? -
i have custom viewgroup, 1 thing, changing background's alpha on layout phase:
@override protected void onlayout(boolean changed, int l, int t, int r, int b) { ... getbackground().setalpha(0); ... }
print alpha in setbackground
:
@override public void setbackground(drawable background) { if (background instanceof colordrawable) { bgalpha = color.alpha(((colordrawable) background).getcolor()); d("bg:" + integer.tohexstring(bgalpha)); super.setbackground(background); } else { ... } }
now have activity inflate custom view layout xml:
<customviewgroup android:layout_width="match_parent" android:layout_height="match_parent" android:background="#88000000" />
when first launch app, setbackground
print:
bg:88
then finish app , reopen launcher, setbackground
print:
bg:0
why background drawable retain state after activity finished?
Comments
Post a Comment