Android - how to make a scrollable constraintlayout?

前端 未结 17 1742
故里飘歌
故里飘歌 2020-11-30 19:46

I want to make a layout that lets me scroll down using constraint layout, but I don\'t know how to go about it. Should the ScrollView be the parent of the

17条回答
  •  广开言路
    2020-11-30 20:14

    To summarize, you basically wrap your android.support.constraint.ConstraintLayout view in a ScrollView within the text of the *.xml file associated with your layout.

    Example activity_sign_in.xml

    
    
     
    
        
    
            
    
        
    
    

    Note 1: The scroll bars only appear if a wrap is needed in any way, including the keyboard popping up.

    Note 2: It also wouldn't be a bad idea to make sure your ConstraintLayout is big enough to the reach the bottom and sides of any given screen, especially if you have a background, as this will ensure that there isn't odd whitespace. You can do this with spaces if nothing else.

提交回复
热议问题