ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [1] Button, Spinner, ListView, Weight
    Develpment/Android Sample Source 2020. 9. 13. 21:37

    1. Button


     SampleSource

     

    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
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/activity_button"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="com.ssh.user.ex_1201.ButtonActivity"
        android:orientation="vertical">
     
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="btn" />
     
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="http://www.naver.com"
            android:autoLink="web" />
     
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="#0000f0"
            android:text="blue" />
     
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@mipmap/ic_launcher" />
     
    </LinearLayout>
     
    cs


     



    2. Spinner


     Sample Source 

     

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    <?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:id="@+id/activity_spinner"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="com.ssh.user.ex_1201.SpinnerActivity">
     
        <Spinner
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:entries="@array/study"/>
    </RelativeLayout>
     
    cs

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
     
        <string-array name="study">
     
            <item>java</item>
            <item>android</item>
            <item>jsp</item>
            <item>html</item>
     
        </string-array>
     
    </resources>
    cs


     

     




    3. ListView


     Sample Source 

     

    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
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/activity_list_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="com.ssh.user.ex_1201.ListViewActivity"
        android:orientation="vertical">
     
        <ListView
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:background="#aaa"
            android:entries="@array/car"/>
     
        <ListView
            android:id="@+id/list"
            android:layout_width="wrap_content"
            android:layout_height="200dp"
            android:background="#aaf"/>
     
    </LinearLayout>
    cs


     



    4. Weight


    Sample Source

     

    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
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/activity_weight"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="com.ssh.user.ex_1201.WeightActivity"
        android:orientation="vertical">
     
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
     
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="red"
                android:layout_weight="1"/>
     
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="blue"/>
     
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="toast"/>
     
        </LinearLayout>
     
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
     
            <EditText
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:hint="edit text..."
                android:layout_weight="1"/>
     
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="start"/>
     
        </LinearLayout>
     
        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#000"
            android:layout_weight="1"/>
     
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="btn"/>
     
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
     
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:text="btn1"/>
     
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="btn2"/>
     
        </LinearLayout>
     
    </LinearLayout>
     
    cs


     




    댓글

Designed by Tistory.