Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
CustomNotifications / res / layout /

sample_main.xml

       
        1
       
       
        <!--
       
       
        2
       
       
        * Copyright (C) 2013 The Android Open Source Project
       
       
        3
       
       
        * Licensed under the Apache License, Version 2.0 (the "License");
       
       
        4
       
       
        * you may not use this file except in compliance with the License.
       
       
        5
       
       
        * You may obtain a copy of the License at
       
       
        6
       
       
        *
       
       
        7
       
       
        *       http://www.apache.org/licenses/LICENSE-2.0
       
       
        8
       
       
        *
       
       
        9
       
       
        * Unless required by applicable law or agreed to in writing, software
       
       
        10
       
       
        * distributed under the License is distributed on an "AS IS" BASIS,
       
       
        11
       
       
        * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
       
        12
       
       
        * See the License for the specific language governing permissions and
       
       
        13
       
       
        * limitations under the License.
       
       
        14
       
       
        -->
       
       
        15
       
       
       
       
        16
       
       
        <!-- Layout for MainActivity.
       
       
        17
       
       
        Includes an introductory text and a button to show the notification. -->
       
       
        18
       
       
       
       
        19
       
       
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       
       
        20
       
       
        xmlns:tools="http://schemas.android.com/tools"
       
       
        21
       
       
        android:layout_width="match_parent"
       
       
        22
       
       
        android:layout_height="match_parent"
       
       
        23
       
       
        android:paddingLeft="@dimen/activity_horizontal_margin"
       
       
        24
       
       
        android:paddingRight="@dimen/activity_horizontal_margin"
       
       
        25
       
       
        android:paddingTop="@dimen/activity_vertical_margin"
       
       
        26
       
       
        android:paddingBottom="@dimen/activity_vertical_margin"
       
       
        27
       
       
        android:orientation="vertical"
       
       
        28
       
       
        tools:context=".MainActivity"
       
       
        29
       
       
        android:gravity="center_horizontal">
       
       
        30
       
       
       
       
        31
       
       
        <TextView
       
       
        32
       
       
        android:layout_width="wrap_content"
       
       
        33
       
       
        android:layout_height="wrap_content"
       
       
        34
       
       
        android:text="@string/intro_text" />
       
       
        35
       
       
       
       
        36
       
       
        <Button
       
       
        37
       
       
        android:layout_width="wrap_content"
       
       
        38
       
       
        android:layout_height="wrap_content"
       
       
        39
       
       
        android:text="@string/show_notification"
       
       
        40
       
       
        android:id="@+id/button"
       
       
        41
       
       
        android:onClick="showNotificationClicked" />
       
       
        42
       
       
       
       
        43
       
       
        </LinearLayout>