close
The Wayback Machine - https://web.archive.org/web/20160417071700/https://developer.android.com/samples/ConfirmCredential/res/layout/activity_main.html
Show navigation Hide navigation
ConfirmCredential / res / layout /

activity_main.xml

1
<?xml version="1.0" encoding="utf-8"?>
2
<!--
3
  ~ Copyright (C) 2015 The Android Open Source Project
4
  ~
5
  ~ Licensed under the Apache License, Version 2.0 (the "License");
6
  ~ you may not use this file except in compliance with the License.
7
  ~ You may obtain a copy of the License at
8
  ~
9
  ~      http://www.apache.org/licenses/LICENSE-2.0
10
  ~
11
  ~ Unless required by applicable law or agreed to in writing, software
12
  ~ distributed under the License is distributed on an "AS IS" BASIS,
13
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
  ~ See the License for the specific language governing permissions and
15
  ~ limitations under the License
16
  -->
17
<ScrollView
18
        xmlns:android="http://schemas.android.com/apk/res/android"
19
        android:layout_width="match_parent"
20
        android:layout_height="match_parent">
21
 
22
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
23
                  android:layout_width="match_parent"
24
                  android:layout_height="wrap_content"
25
                  android:orientation="vertical">
26
 
27
        <ImageView
28
                android:layout_width="150dp"
29
                android:layout_height="150dp"
30
                android:layout_marginTop="32dp"
31
                android:layout_marginBottom="32dp"
32
                android:layout_gravity="center_horizontal"
33
                android:scaleType="fitCenter"
34
                android:src="@drawable/android_robot"/>
35
 
36
        <LinearLayout
37
                android:layout_width="match_parent"
38
                android:layout_height="wrap_content"
39
                android:layout_marginTop="8dp"
40
                android:layout_marginStart="8dp"
41
                android:layout_marginEnd="8dp"
42
                android:orientation="vertical"
43
                android:background="@drawable/card"
44
                android:elevation="4dp"
45
                android:paddingTop="16dp"
46
                android:paddingBottom="16dp"
47
                android:paddingStart="16dp"
48
                android:paddingEnd="16dp">
49
 
50
            <TextView
51
                    android:layout_width="wrap_content"
52
                    android:layout_height="wrap_content"
53
                    android:textAppearance="@android:style/TextAppearance.Material.Headline"
54
                    android:text="@string/item_title"/>
55
 
56
            <TextView
57
                    android:layout_width="wrap_content"
58
                    android:layout_height="wrap_content"
59
                    android:textAppearance="@android:style/TextAppearance.Material.Body2"
60
                    android:textColor="?android:attr/colorAccent"
61
                    android:text="@string/item_price"/>
62
 
63
            <TextView
64
                    android:layout_width="wrap_content"
65
                    android:layout_height="wrap_content"
66
                    android:layout_marginTop="16dp"
67
                    android:textAppearance="@android:style/TextAppearance.Material.Body1"
68
                    android:textColor="?android:attr/textColorSecondary"
69
                    android:text="@string/item_description"/>
70
 
71
        </LinearLayout>
72
        <Button style="@android:style/Widget.Material.Button.Colored"
73
                android:layout_width="wrap_content"
74
                android:layout_height="wrap_content"
75
                android:layout_marginTop="8dp"
76
                android:layout_marginEnd="4dp"
77
                android:layout_gravity="end"
78
                android:textColor="?android:attr/textColorPrimaryInverse"
79
                android:text="@string/purchase"
80
                android:id="@+id/purchase_button"
81
                android:layout_alignParentEnd="true"/>
82
 
83
        <TextView
84
                android:id="@+id/confirmation_message"
85
                android:layout_width="wrap_content"
86
                android:layout_height="wrap_content"
87
                android:layout_marginTop="16dp"
88
                android:paddingStart="16dp"
89
                android:paddingEnd="16dp"
90
                android:textAppearance="@android:style/TextAppearance.Material.Body2"
91
                android:textColor="?android:attr/colorAccent"
92
                android:text="@string/purchase_done"
93
                android:visibility="gone"/>
94
 
95
        <TextView
96
                android:id="@+id/already_has_valid_device_credential_message"
97
                android:layout_width="wrap_content"
98
                android:layout_height="wrap_content"
99
                android:layout_marginTop="16dp"
100
                android:paddingStart="16dp"
101
                android:paddingEnd="16dp"
102
                android:textAppearance="@android:style/TextAppearance.Material.Body2"
103
                android:textColor="?android:attr/colorAccent"
104
                android:text="@string/already_confirmed_device_credentials_within_last_x_seconds"
105
                android:visibility="gone"/>
106
    </LinearLayout>
107
</ScrollView>