用LayerDrawable实现两个图片的叠加效果
Drawable[] layers = new Drawable[2]; layers[0] = new ColorDrawable(primaryColor); layers[1] = new ColorDrawable(0x7f000000); LayerDrawable layerDrawable = new LayerDrawable(layers); layerDrawable.setLayerInset(0, 0, 0, 0, 0); layerDrawable.setLayerInset(1, 0, 0, 0, 0); setBackground(layerDrawable);也能够用
layer-list
在xml中实现