用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中实现
posted @ 2017-05-29 18:54  brucemengbm  阅读(1254)  评论(0编辑  收藏  举报