8 Nisan 2011 Cuma

Layout Türleri – ScrollView

İnceleyeceğimiz son layout türü ScroolView dir.
Scrollview aslında Framelayout un spesifikleşmiş bir halidir. Scrollview bize içerisinde kullandığımız ögeler bütününü scroll etmemizi sağlar. İçerisinde sadece bir tane view veya viewGroup olabilir ki genellikle de bu içteki viewGroup LinearLayout olur. Ayrıca Listview scrollview ile kullanılmamalıdır.

Hemen örnek kod yazalım:
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
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    android:id="@+id/widget54"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    >
    <LinearLayout
        android:layout_width="310px"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        >
        <Button
            android:id="@+id/button1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Button 1"
            />
        <Button
            android:id="@+id/button2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Button 2"
            />
        <Button
            android:id="@+id/button3"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Button 3"
            />
        <EditText
            android:id="@+id/txt"
            android:layout_width="fill_parent"
            android:layout_height="300px"
            />
        <Button
            android:id="@+id/button4"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Button 4"
            />
        <Button
            android:id="@+id/button5"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Button 5"
            />
    </LinearLayout>
</ScrollView>
Ekran görüntüsü ise aşağıdaki gibidir.

0 yorum:

Yorum Gönder

 
© 2011 Ömer Faruk ÖZDEMİR |