Android Self-paced scrolling view ScrollView

Source: Internet
Author: User

Scrolling view ScrollView is derived from Farmelayout, which is a component used to add a vertical scrollbar to a normal component; ScrollView contains at most one component, and ScrollView's role is to add a vertical scrollbar to the component. (ScrollView's role is very similar to JScrollPane, and they can't even be called real containers.) They just add scroll bars to other containers. By default, ScrollView just adds a vertical scrollbar to other components, and if the app requires a horizontal scroll bar, it can be implemented with another component: Horizontalscrollview. The functions of Horizontalscrollview and ScrollView are basically similar, except that the former adds a horizontal scroll bar, which adds a vertical scrollbar.

Take a look at the application of Horizontalscrollview and ScrollView through a program. Nesting a horizontalscrollview in ScrollView to add horizontal, vertical scroll bars to the app's interface at the same time

Layout/main.xml

1 <?XML version= "1.0" encoding= "Utf-8"?>2 <!--define ScrollView to add a vertical scrollbar to the inside component -3 <ScrollViewxmlns:android= "Http://schemas.android.com/apk/res/android"4 Android:layout_width= "Fill_parent"5 Android:layout_height= "Fill_parent" >6     7     <!--define Horizontalscrollview To add a horizontal scrollbar to the components inside -    8     <Horizontalscrollview9         Android:layout_width= "Fill_parent"Ten Android:layout_height= "Wrap_content"> One         <LinearLayoutandroid:orientation= "vertical" A Android:layout_width= "Fill_parent" - Android:layout_height= "Fill_parent"> -         <TextViewAndroid:layout_width= "Wrap_content" the Android:layout_height= "Wrap_content"  - Android:text= " scroll view scrolling View" - android:textsize= "30DP" /> -         <TextViewAndroid:layout_width= "Wrap_content" + Android:layout_height= "Wrap_content"  - Android:text= " scroll view scrolling View" + android:textsize= "30DP" /> A         <TextViewAndroid:layout_width= "Wrap_content" at Android:layout_height= "Wrap_content"  - Android:text= " scroll view scrolling View" - android:textsize= "30DP" /> -         <TextViewAndroid:layout_width= "Wrap_content" - Android:layout_height= "Wrap_content"  - Android:text= " scroll view scrolling View" in android:textsize= "30DP" /> -         <TextViewAndroid:layout_width= "Wrap_content" to Android:layout_height= "Wrap_content"  + Android:text= " scroll view scrolling View" - android:textsize= "30DP" /> the         <TextViewAndroid:layout_width= "Wrap_content" * Android:layout_height= "Wrap_content"  $ Android:text= " scroll view scrolling View"Panax Notoginseng android:textsize= "30DP" /> -         <TextViewAndroid:layout_width= "Wrap_content" the Android:layout_height= "Wrap_content"  + Android:text= " scroll view scrolling View" A android:textsize= "30DP" /> the         <TextViewAndroid:layout_width= "Wrap_content" + Android:layout_height= "Wrap_content"  - Android:text= " scroll view scrolling View" $ android:textsize= "30DP" /> $         <TextViewAndroid:layout_width= "Wrap_content" - Android:layout_height= "Wrap_content"  - Android:text= " scroll view scrolling View" the android:textsize= "30DP" /> -             Wuyi         </LinearLayout> the          -     </Horizontalscrollview> Wu      - </ScrollView>

The above interface shows and runs the effect:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.