Do I need to change my xml code for supporting all screen size android devices?

后端 未结 2 1944
抹茶落季
抹茶落季 2021-01-27 08:17

I have created layout for different screen size and this is my xml code for default layout but so any one please tell me what I should do to support my layout for any screen si

2条回答
  •  渐次进展
    2021-01-27 08:50

    I edited you XML so it may be a good start for learning how to use ConstraintLayout. Check a tutorial for ConstraintLayout (constraintlayout.com)

    1. Don't use match_parent with ConstraintLayout we only have 0dp (match_constraint) and wrap_conent
    2. Don't mess up the XML with unneccessary nested ViewGroups (LinearLayout)
    3. When using margin or padding best to use numbers based on 8 (8 - 16 - 24 - 32 - ...)
    4. Using a CardView for button is wrong, check MaterialButton documents at material.io
    
    
    
        
    
            
    
            
    
            
    
                
    
            
    
            
    
                
            
    
            
    
            
    
            
    
            
    
        
    
    
    

提交回复
热议问题