1. activity_maim.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/view1"
android:layout_width="100dip"
android:layout_height="120dip"
android:background="@android:color/white"
android:padding="8dip"
android:scrollbarStyle="insideOverlay" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray"
android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"
android:textColor="#ffffff" />
</ScrollView>
<ScrollView
android:id="@+id/view2"
android:layout_width="100dip"
android:layout_height="120dip"
android:background="@android:color/white"
android:padding="8dip"
android:scrollbarStyle="insideInset" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray"
android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"
android:textColor="#ffffff" />
</ScrollView>
<ScrollView
android:id="@+id/view3"
android:layout_width="100dip"
android:layout_height="120dip"
android:background="@android:color/white"
android:padding="8dip"
android:scrollbarStyle="outsideOverlay" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray"
android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"
android:textColor="#ffffff" />
</ScrollView>
<ScrollView
android:id="@+id/view4"
android:layout_width="100dip"
android:layout_height="120dip"
android:background="@android:color/white"
android:padding="8dip"
android:scrollbarStyle="outsideInset" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray"
android:text="scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text scroll_text"
android:textColor="#ffffff" />
</ScrollView>
</LinearLayout>
2. 运行结果截图:
3. 相关说明:
insideInset、insideOverlay、outsideInset、outsideOverlay分别对应上图右边解释!