Cdacians

Cdacians
Cdacians

Tuesday 7 August 2012

ScrollView and HorizontalScrollView


ScrollView and HorizontalScrollView

ScrollView and HorizontalScrollView are layout container for a view hierarchy that can be scrolled vertically or horizontally by the user, allowing it to be larger than the physical display. A ScrollView/HorizontalScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects.

ScrollView and HorizontalScrollView

?
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  >
<TextView
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="@string/hello"
  />
<HorizontalScrollView
  android:layout_width="wrap_content"
  android:layout_height="wrap_content">
<LinearLayout
  android:orientation="vertical"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content">
<TextView
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="Inside 1st HorizontalScrollView" />
<LinearLayout
  android:orientation="horizontal"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content">
<Button
  android:text="Button A1"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
<Button
  android:text="Button A2"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
<Button
  android:text="Button A3"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
<Button
  android:text="Button A4"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
<Button
  android:text="Button A5"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
<HorizontalScrollView
  android:layout_width="wrap_content"
  android:layout_height="wrap_content">
<LinearLayout
  android:orientation="vertical"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content">
<TextView
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="Inside 2nd HorizontalScrollView" />
<LinearLayout
  android:orientation="horizontal"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content">
<Button
  android:text="Button B1"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
<Button
  android:text="Button B2"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
<Button
  android:text="Button B3"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
<Button
  android:text="Button B4"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
<Button
  android:text="Button B5"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
<Button
  android:text="Button B6"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
<ScrollView
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<LinearLayout
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" >
<TextView
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="Inside ScrollView" />
<Button
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="Button C"/>
<Button
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="Button D"/>
<Button
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="Button E"/>
<Button
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="Button F"/>
<Button
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="Button G"/>
<Button
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="Button H"/>
<Button
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="Button I"/>
</LinearLayout>
</ScrollView>
</LinearLayout>





akm
www.cdacians.com

No comments:

Post a Comment