How to set the surface view camera background with corner

前端 未结 3 852
执念已碎
执念已碎 2021-01-14 13:30

My app uses a camera surface view layout with a size of 150 X 150. I need to show the surface corner is arc type. how to set the corner in camera.



        
3条回答
  •  Happy的楠姐
    2021-01-14 13:53

    Check out this tutorial on how to create an Android shape and apply that shape to your layout: http://www.vogella.com/blog/2011/07/19/android-shapes/

    Specifically you use the attribute of the to create rounded corners, see example below from the above referenced tutorial:

    
    



    UPDATE 2 - This worked for me:

    drawable-hdpi/rounded.xml:

    
     
    
        
    
         
    
        
    
    
    

    drawable-hdpi/solid.xml:

    
     
    
        
    
        
    
    
    

    drawable-hdpi/rounded_inside_corners.xml:

    
    
    
        
         
    
    
    


    Then in my activity layout:

    
    
        
    
        
    
            


    Which results in:

    enter image description here

提交回复
热议问题