ScrollView cuts off the top and leaves space at the bottom

后端 未结 8 863
谎友^
谎友^ 2021-02-03 19:41

When I launch the emulator and enter the screen which uses this code it shows most of the text information but cuts off the top of the screen (cant scroll up) but leaves a bit o

8条回答
  •  醉话见心
    2021-02-03 19:51

    The best answer I have found and tested that fixes this problem is the one that @hadi gave in this question: no gravity for scrollview. how to make content inside scrollview as center

    Resuming the answer:

    • Put your ScrollView inside a RelativeLayout.
    • In the ScrollView, set the following:
      • android:layout_height="wrap_content"
      • android:layout_centerVertical="true"
    • Put your vertical LinearLayout inside the ScrollView.

    The code would be:

    
    
        
    
            
    
                ...
    
            
        
    
    

提交回复
热议问题