Android5.0以上系统,从一个页面返回后白色背景会变灰色半透明,求解

Android5.0以上系统,从一个页面返回后白色背景会变灰色半透明,求解

问题描述:

接手一个别人写的项目,出现了这个问题虽然已经解决了但是不知道原理。
问题如下:MainActivity中有四个Fragment,进入登录页面再返回的时候,有两个Fragment白色背景会变成灰色,某些从MainActivity进入的二级页也会出现这个问题,我再那些背景变成灰色的页面onCreate的时候手动设置背景色为白色解决了,但是不知道这个问题到底是为什么出现的仅,限于5.0以上的系统才出现。求各位帮忙分析一下。下面是一个会变灰的页面的布局。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/banner_detail_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white"
        android:orientation="vertical">

        <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:paddingLeft="10dp"
                >

                <Button
                        android:id="@+id/back_banner_btn"
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:background="@drawable/back"
                        android:layout_centerVertical="true"
                        android:onClick="onClick"
                        />

                <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:layout_centerInParent="true"
                        android:gravity="center_vertical"
                        android:text="最新活动"
                        android:textSize="18sp"
                        android:textColor="@color/black" />
        </RelativeLayout>

        <TextView
                android:layout_width="match_parent"
                android:layout_height="10dp"
                android:background="@color/darkline" />
        <WebView 
                android:id="@+id/webview_banner"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/white"
                />

</LinearLayout>

开启自问自答模式,终于找到问题所在了,登录页有控件调用了这个方法getBackground().setAlpha(100),就导致跟这个背景使用同一个颜色的控件都加了透明度,这里有详细解答!!好激动!!http://blog.csdn.net/myatlantis/article/details/49336587

什么手机上出现的,感觉这类问题好多都是不同手机的适配问题