ScrollView cuts off the top and leaves space at the bottom

后端 未结 8 861
谎友^
谎友^ 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 20:01

    Remove layout_gravity from Linear/Relative layout inside Horizontalscroll view, it'll work .

    0 讨论(0)
  • 2021-02-03 20:06

    If you want the TextViews to be scrollable, why don't you put ScrollView around this 2 elements?

     <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_gravity="center"
        android:padding="10dip" >
    
    
        <ScrollView>
         <ImageView
            android:id="@+id/earthSymbolImageView"
            android:layout_width="25dp"
            android:layout_height="25dp"
            android:src="@drawable/earthsymbol" />
    
         <TextView
            android:id="@+id/earth_content1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/earth_title"
            android:gravity="center" 
            android:textColor="#FFFFFF"
            android:textSize="20sp" />
    
        <TextView
            android:id="@+id/earth_content2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/earth_text" 
            android:textColor="#FFFFFF" />
    
         </ScrollView>
    
        <Button
            android:id="@+id/backButton"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/back" />
    
    
    
         </LinearLayout>
    
    0 讨论(0)
提交回复
热议问题