 
        به نام خدا
سلام به دوستان همیشه همراه
در این جلسه از آموزش میخام ScrollView رو بهتون آموزش بدم
حالا ScrollView چی هستت ، در بعضی مواقع دیدین که آیتم های استفاده شده در یک دسته یا یک صفحه
بیشتر از حجم نمایشگر تصویر هستن و اون ها به ترتیب یا در کنار هم قرار میگیرند یا در زیر یکدیگر
و با کشیدن انگشت بر روی تصویر میتونیم آیتم ها رو حرکت بدیم و به سایر آیتم ها دسترسی پیدا کنیم
برای مثال گالری تصاویراز یک نمونه ScrollView استفاده کرده یا لیست مخاطبین و .......
خب در این آموزش من ScrollView از نوع عمودی رو بهتون آموزش میدم
من میام یک ویجیت ScrollView رو اضافه میکنم و درون اون یک LinearLayout جایگذاری میکنم
و درون LinearLayout چندین Button اضافه میکنم تا جایی که تعدادشون زیاد بشه که بتونم اونا رو با
لمس کردن به بالا و پایین بکشم البته در اول کد یعنی خارج از ScrollView اومدم و یک TextView اضافه کردم
که متن داخلش رو هر چیزی میتونید بنویسید مثلا اسم لیست رو میتونید بنویسید که من داخلش نوشتم ScrollView
خب میرم سراغ نوشتن کد XML
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="HamyarAndroid.com/ScrollView"
        android:id="@+id/textView"
        android:layout_gravity="center_horizontal"
        android:layout_centerHorizontal="true"
        android:layout_alignParentTop="true" />
    <ScrollView android:layout_marginTop="30dp"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/scrollView">
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical" >
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 1" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 2" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 3" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 4" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 5" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 6" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 7" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 8" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 9" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 10" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 11" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 12" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 13" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 14" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 15" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 16" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 17" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 18" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 19" />
            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Button 20" />
        </LinearLayout>
    </ScrollView>
</RelativeLayout>
خب همونطور که در بالا میبینید من چندین باتن اضافه کردم که خاصیت scroll شدن دارند و خروجی کد بالا رو می تونید در تصویر زیر ببینید

