Android 在一个页面上设置toolbar透明度(用Java代码设置),所有的页面都会变成透明色
toolbar1.getBackground().setAlpha(100);
然后我又用了第二种方法设置透明度
Drawable mDrawable = ContextCompat.getDrawable(getActivity(), R.color.colorPrimary);
mDrawable.setAlpha(255*totalDy/500);
toolbar.setBackground(mDrawable);
可是这样做还是不行我就怀疑是不是颜色的问题 所以我换了一种颜色表示方法 将colorPrimary换成home_toolbar可还是不行 最后将home_toolbar改成与colorPrimary色值相差一位就可以了
<color name="colorPrimary">#FC3A43</color>
<color name="home_toolbar">#FC3A44</color>
原因还是不知道 请哪位大神指教