ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • NotificationService Player[2]
    App/Android 2017. 2. 23. 17:02

    // layout/status_bar.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
    62
    63
    64
    65
    66
    67
     
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal" >
     
        <ImageView
            android:id="@+id/status_bar_album_art"
            android:layout_width="@dimen/status_bar_album_art"
            android:layout_height="@dimen/status_bar_album_art"
            android:gravity="center" />
     
        <ImageView
            android:id="@+id/status_bar_icon"
            android:layout_width="@dimen/status_bar_album_art"
            android:layout_height="@dimen/status_bar_album_art"
            android:background="@drawable/status_bg"
            android:scaleType="center"
            android:src="@drawable/ic_launcher"
            android:visibility="gone" />
     
        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"
            android:orientation="vertical"
            android:paddingLeft="@dimen/status_bar_button_info_container_padding_left" >
     
            <TextView
                android:id="@+id/status_bar_track_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/white"
                android:textSize="@dimen/text_size_medium"
                android:textStyle="bold" />
     
            <TextView
                android:id="@+id/status_bar_artist_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
     
        </LinearLayout>
     
        <ImageButton
            android:id="@+id/status_bar_play"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/cd_play" />
     
        <ImageButton
            android:id="@+id/status_bar_next"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/cd_next"
            android:src="@drawable/apollo_holo_dark_next" />
     
        <ImageButton
            android:id="@+id/status_bar_collapse"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/apollo_holo_dark_notifiation_bar_collapse" />
     
    </LinearLayout>
     
     
    cs


    // drawable/status_bg.xml

    1
    2
    3
    4
    <?xml version="1.0" encoding="utf-8"?>
    <bitmap xmlns:android="http://schemas.android.com/apk/res/android"
        android:src="@drawable/notify_panel_notification_icon_bg"
        android:tileMode="repeat" />
    cs


    // values/strings.xml

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    <?xml version="1.0" encoding="utf-8"?>
    <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     
        <!-- App name -->
        <string name="app_name">Music Notification</string>
        <string name="app_version_number">1.0</string>
        <string name="menu_settings">Settings</string>
     
        <string name="cd_repeat">Repeat one or all</string>
        <string name="cd_previous">Skip backwards</string>
        <string name="cd_play">Play and pause</string>
        <string name="cd_next">Skip forwards</string>
     
    </resources>
    cs


    // values/colors.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
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
     
        <!-- A transparent black -->
        <color name="transparent_black">#aa000000</color>
     
        <!-- selected tab text -->
        <color name="selected_tabtext">#bb000000</color>
     
        <!-- non selected tab text -->
        <color name="unselected_tabtext">#77000000</color>
        <color name="shuffle_grey">#ffdedede</color>
        <color name="background_grey">#ffdedede</color>
     
        <!-- Transparent -->
        <color name="transparent">#00000000</color>
     
        <!-- Black -->
        <color name="black">#ff000000</color>
     
        <!-- White -->
        <color name="white">#ffffffff</color>
     
    </resources>
    cs


    // values/dimens.xml

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
     
        <!-- Text sizes -->
        <dimen name="text_size_extra_micro">10sp</dimen>
        <dimen name="text_size_micro">12sp</dimen>
        <dimen name="text_size_small">14sp</dimen>
        <dimen name="text_size_medium">16sp</dimen>
        <dimen name="text_size_large">18sp</dimen>
         
        <!-- Nofication bar button -->
        <dimen name="status_bar_button_width_height">48dp</dimen>
        <dimen name="status_bar_album_art">64dp</dimen>
        <dimen name="status_bar_button_info_container_padding_left">11dp</dimen>
        <dimen name="notification_expanded_height">128.0dip</dimen>
        <dimen name="play_controls_notification">48.0dip</dimen>
        <dimen name="notification_padding">8.0dip</dimen>
     
    </resources>
    cs


    //AndroidManifest.xml 

    1
    2
    <service android:name=".NotificationService" />
     
    cs



    출처 : http://www.tutorialsface.com/2015/08/android-custom-notification-tutorial/



    'App > Android' 카테고리의 다른 글

    NotificationService Player[1]  (0) 2017.02.23
Designed by Tistory.