Android Tutorial , Programming Tutorial, Php Tutorial, Learn Android, HTML Tutorial, Coding , Java Tutorial, GTU Programs, Learning Programming

Saturday 10 September 2016

Android Tutorial : ScrollView Example

Scroll View is a special type of layout which is enables users to scroll through a list of views.It can contain only one child view or ViewGroup.


  • Modify the content of activity_main.xml file and show the ScrollView with LinearLayout

File Name : activity_main.xml




 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    >
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">
    <TextView
        android:id="@+id/title"
        android:layout_width="fill_parent"
        android:text="Scroll View Example"
        android:gravity="center"
        android:textSize="20dp"
        android:layout_height="fill_parent"/>
    
    <EditText
        android:id="@+id/fname"
        android:layout_width="fill_parent"
        android:hint="Enter First Name"
        android:layout_height="300px"/>
        
    <EditText
        android:id="@+id/mname"
        android:layout_width="fill_parent"
        android:hint="Enter Middle Name"
        android:layout_height="300px"/>
    
    <EditText
        android:id="@+id/lname"
        android:layout_width="fill_parent"
        android:hint="Enter Last Name"
        android:layout_height="300px"/>
    
    <EditText
        android:id="@+id/message"
        android:layout_width="fill_parent"
        android:hint="Write Your Text Message"
        android:layout_height="300px"/>
    
    <EditText
        android:id="@+id/suggestion"
        android:layout_width="fill_parent"
        android:hint="Write Your Suggestion"
        android:layout_height="300px"/>
    
    <Button
        android:id="@+id/submit"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Submit"/>
    <Button
        android:id="@+id/cancel"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Cancel"/>
            
    </LinearLayout>
    </ScrollView>

Output:

 ScrollView  ScrollView1

0 comments:

Post a Comment

Like us on Facebook

Site Visitor

Powered by Blogger.