Android: Image over image

前端 未结 4 2106
-上瘾入骨i
-上瘾入骨i 2020-12-15 07:29

I have a video thumbnail and when you click on it, the video starts playing in the YouTube player.

This works, but It\'s not clear that you have to click on the thum

4条回答
  •  囚心锁ツ
    2020-12-15 07:32

    This is Easiest Way i Found i think to merge morethan one images in one. this is very helpful if we want share merged file.

    Resources r = getResources();    
    Drawable[] layers = new Drawable[3];
    layers[0] = r.getDrawable(R.drawable.image3);
    layers[1] = r.getDrawable(R.drawable.image1);
    layers[2] = r.getDrawable(R.drawable.image2);
    
    LayerDrawable layerDrawable= new LayerDrawable(layers);
    
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    // align image1 over image3
    layerDrawable.setLayerGravity(1, Gravity.TOP);
    layerDrawable.setLayerInsetTop(1, 250);
    
    // align image2 over image3
    layerDrawable.setLayerGravity(2, Gravity.BOTTOM);
    layerDrawable.setLayerInsetBottom(2, 250);
    }
     // both image1 & 2 placed over image3 in layerDrawable.
    imageView.setImageDrawable(layerDrawable);
    

    Hope this will works

提交回复
热议问题