Android drawable speech bubble

前端 未结 6 537
情深已故
情深已故 2020-12-04 14:10

I\'ve looked for days and can not find any good leads on how I can draw a bubble or where a draw 9 patch images is to use as a background. i am a terrible artist --Can anyo

6条回答
  •  再見小時候
    2020-12-04 15:05

    Here is a simple speech bubble drawable I made. Hopefully, it's start in the right direction for someone. The view that this drawable is used in needs a height of at least 70-80dp and a similar minimum width to show properly.

    
    
    
        
            
                
                    
                
            
        
        
            
                
    
                
            
        
    
    
    

    Android Drawables leave a lot to be desired in terms of how usable they are for drawing anything even slightly complex.

    This version looks like this:

    UPDATE I've been working on XML speech bubbles again and was a little dissatisfied with my 2014 solution. In 2018, we have vector drawables which enable better solutions than the one above. Here are some more modern alternatives. They allow things like small messages and transparency.

    speech_bubble_simple_user.xml

    
    
    
        
            
                
                
            
        
    
        
            
                
            
        
    
    
    

    speech_bubble_simple_agent.xml

    
    
    
        
            
                
                
            
        
    
        
            
                
            
        
    
    
    

    The two above look like this: (These versions don't quite work with transparency and I'm not sure why when the versions below seem to work fine.)

    speech_bubble_nine_patch_user.xml

    
    
    
        
            
                
            
        
    
        
            
                
            
        
    
        
            
                
            
        
    
        
            
                
            
        
    
        
            
                
            
        
    
        
            
                
            
        
    
        
            
                
            
        
    
    
    

    speech_bubble_nine_patch_agent.xml

    
    
    
        
            
                
            
        
    
        
            
                
            
        
    
        
            
                
            
        
    
        
            
                
            
        
    
        
            
                
            
        
    
        
            
                
            
        
    
        
            
                
            
        
    
    
    

    The two above look like this:

    dimens.xml (for both)

    10dp
    15dp
    5dp
    25dp
    

提交回复
热议问题