Android - Best way to overlay a play button on an image/thumbnail

前端 未结 2 1162
日久生厌
日久生厌 2021-02-04 09:51

I have an android application which can playback audio/video and show pictures. For videos I want to overlay a play button on top of the preview image and also in list views.. R

2条回答
  •  抹茶落季
    2021-02-04 10:46

    I ended up using a FrameLayout like this:

    
    
    
    
    
    
    
    

    Then I just set the visibility to View.VISIBLE to the preview play button for videos and left it gone for photos. For my list view I used the layer list method shown above because all of the thumbnails were the same dimension. Hope this helps someone else!

    notice that the layout_gravity on the ImageView with id VideoPreviewPlayButton puts it at the bottom centered horizontally, and the 10dp paddingBottom moves it up a bit from the bottom.

提交回复
热议问题