Activity background becoming black! [duplicate]
i have set the background of an activity with a green gradient png image as
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
and开发者_如何学Pythonroid:layout_height="fill_parent"
android:background="@drawable/bg"
android:orientation="vertical">
...
</LinearLayout>
This working fine almost always but some times during navigating to an activity its background is becoming black! i am not able to reproduce it with any specific operation, also not getting how to debug or fix it.
Are you using a ListView? Try setting the android:cacheColorHint="#00000000"
as described here.
Most likely you are not cleaning up/resuming your activity properly. We'll have to see your onPause and onResume, etc... of that activity to see what you are doing. This has nothing to do with the layout file.
Ashis I believe you are trying to perform a lot of operations on UI thread's lifecycle activities(onCreate,etc).So please post a snippet of your Activity's lifecycle methods
精彩评论