no gravity for scrollview. how to make content inside scrollview as center

后端 未结 7 918
刺人心
刺人心 2020-12-07 09:35

I want the content inside the scrollView as center.



        
相关标签:
7条回答
  • 2020-12-07 10:21

    How about this?

    <?xml version="1.0" encoding="utf-8"?>
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/scrollView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:paddingTop="12dp"
        android:paddingBottom="20dp"
        android:scrollbarStyle="outsideOverlay" >
    
    
        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" 
            android:layout_gravity="center"
            android:gravity="center">
    
            <Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="check" 
                android:gravity="center_vertical|center_horizontal"/>
        </LinearLayout>
    
    </ScrollView>
    
    0 讨论(0)
提交回复
热议问题