How to add colored border on cardview?

前端 未结 7 1708
遥遥无期
遥遥无期 2020-12-13 05:56

I am new to Android and this is my first question here.

I am trying to add a colored vertical border at the beginning of the cardview. How can I achieve it on xml ?

7条回答
  •  猫巷女王i
    2020-12-13 06:33

    try doing:

    
    
    
        
    
        
    
            
    
            
    
        
    
    
    

    this removes the padding from the cardview and adds a FrameLayout with a color. You then need to fix the padding in the LinearLayout then for the other fields

    Update

    If you want to preserve the card corner radius create card_edge.xml in drawable folder:

    
    
        
        
        
        
    
    

    and in the frame layout use android:background="@drawable/card_edge"

提交回复
热议问题