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)
BorderlessButtons / res / layout /

sample_main.xml

       
        1
       
       
        <!--
       
       
        2
       
       
        Copyright 2013 The Android Open Source Project
       
       
        3
       
       
       
       
        4
       
       
        Licensed under the Apache License, Version 2.0 (the "License");
       
       
        5
       
       
        you may not use this file except in compliance with the License.
       
       
        6
       
       
        You may obtain a copy of the License at
       
       
        7
       
       
       
       
        8
       
       
        http://www.apache.org/licenses/LICENSE-2.0
       
       
        9
       
       
       
       
        10
       
       
        Unless required by applicable law or agreed to in writing, software
       
       
        11
       
       
        distributed under the License is distributed on an "AS IS" BASIS,
       
       
        12
       
       
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
       
        13
       
       
        See the License for the specific language governing permissions and
       
       
        14
       
       
        limitations under the License.
       
       
        15
       
       
        -->
       
       
        16
       
       
       
       
        17
       
       
        <!--
       
       
        18
       
       
        The top-level LinearLayout uses a horizontal divider to visually
       
       
        19
       
       
        distinguish the top description box, list, and bottom button bar.
       
       
        20
       
       
       
       
        21
       
       
        android:showDividers="middle" draws dividers between each child view and
       
       
        22
       
       
        android:divider="?android:dividerHorizontal" indicates that the standard
       
       
        23
       
       
        horizontal system divider (set in the activity's theme) should be used to
       
       
        24
       
       
        draw the divider.
       
       
        25
       
       
        -->
       
       
        26
       
       
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       
       
        27
       
       
        android:orientation="vertical"
       
       
        28
       
       
        android:layout_width="match_parent"
       
       
        29
       
       
        android:layout_height="match_parent"
       
       
        30
       
       
        android:divider="?android:dividerHorizontal"
       
       
        31
       
       
        android:showDividers="middle">
       
       
        32
       
       
       
       
        33
       
       
        <TextView style="@style/Widget.DescriptionBar"
       
       
        34
       
       
        android:layout_width="match_parent"
       
       
        35
       
       
        android:layout_height="wrap_content"
       
       
        36
       
       
        android:text="@string/intro_message" />
       
       
        37
       
       
       
       
        38
       
       
        <!--
       
       
        39
       
       
        Remember to use padding on your ListViews to adhere to the standard
       
       
        40
       
       
        metrics described in the Android Design guidelines. When doing so,
       
       
        41
       
       
        you should set the android:scrollbarStyle such that the scrollbar
       
       
        42
       
       
        doesn'isn't inset.
       
       
        43
       
       
        -->
       
       
        44
       
       
        <ListView android:id="@android:id/list"
       
       
        45
       
       
        android:layout_width="match_parent"
       
       
        46
       
       
        android:layout_height="0dp"
       
       
        47
       
       
        android:layout_weight="1"
       
       
        48
       
       
        android:paddingLeft="@dimen/page_margin"
       
       
        49
       
       
        android:paddingRight="@dimen/page_margin"
       
       
        50
       
       
        android:scrollbarStyle="outsideOverlay" />
       
       
        51
       
       
       
       
        52
       
       
        <!--
       
       
        53
       
       
        When using the Holo theme (setting your activity or app theme to
       
       
        54
       
       
        Theme.Holo or one of its descendants), a LinearLayout with the
       
       
        55
       
       
        ?android:buttonBarStyle will draw dividers (with padding) between
       
       
        56
       
       
        buttons.
       
       
        57
       
       
        -->
       
       
        58
       
       
        <LinearLayout style="?android:buttonBarStyle"
       
       
        59
       
       
        android:layout_width="match_parent"
       
       
        60
       
       
        android:layout_height="wrap_content"
       
       
        61
       
       
        android:orientation="horizontal">
       
       
        62
       
       
       
       
        63
       
       
        <!--
       
       
        64
       
       
        Make sure to apply the ?android:buttonBarStyle to each button
       
       
        65
       
       
        in the button bar.
       
       
        66
       
       
       
       
        67
       
       
        In the Holo theme, this style is very similar to
       
       
        68
       
       
        ?android:borderlessButtonStyle, but designed for use specifically
       
       
        69
       
       
        in horizontal button bars.
       
       
        70
       
       
        -->
       
       
        71
       
       
        <Button style="?android:buttonBarButtonStyle"
       
       
        72
       
       
        android:id="@+id/cancel_button"
       
       
        73
       
       
        android:layout_width="0dp"
       
       
        74
       
       
        android:layout_height="wrap_content"
       
       
        75
       
       
        android:layout_weight="1"
       
       
        76
       
       
        android:text="@string/cancel" />
       
       
        77
       
       
       
       
        78
       
       
        <Button style="?android:buttonBarButtonStyle"
       
       
        79
       
       
        android:id="@+id/ok_button"
       
       
        80
       
       
        android:layout_width="0dp"
       
       
        81
       
       
        android:layout_height="wrap_content"
       
       
        82
       
       
        android:layout_weight="1"
       
       
        83
       
       
        android:text="@string/ok" />
       
       
        84
       
       
       
       
        85
       
       
        </LinearLayout>
       
       
        86
       
       
       
       
        87
       
       
        </LinearLayout>