OLD | NEW |
1 <?xml version="1.0" encoding="utf-8"?> | 1 <?xml version="1.0" encoding="utf-8"?> |
2 <!-- Copyright 2015 The Chromium Authors. All rights reserved. | 2 <!-- Copyright 2015 The Chromium Authors. All rights reserved. |
3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
4 found in the LICENSE file. --> | 4 found in the LICENSE file. --> |
5 | 5 |
6 <!-- | 6 <!-- |
7 Overlays a Button on top of an ImageView. Via a RemoteViews the only way to
set an image, apply | 7 Overlays a Button on top of an ImageView. Via a RemoteViews the only way to
set an image, apply |
8 a color filter, and have API level 16+ compatibility, is to use an ImageView
. There are some | 8 a color filter, and have API level 16+ compatibility, is to use an ImageView
. There are some |
9 similar methods for Button but they are either hidden, require too high an A
PI level, or both. | 9 similar methods for Button but they are either hidden, require too high an A
PI level, or both. |
10 | 10 |
11 The Button must be on top of the ImageView so that it can be tapped, and so
that its text will | 11 The Button must be on top of the ImageView so that it can be tapped, and so
that its text will |
12 be read out by TalkBack. | 12 be read out by TalkBack. |
13 --> | 13 --> |
14 <FrameLayout | 14 <FrameLayout |
15 xmlns:android="http://schemas.android.com/apk/res/android" | 15 xmlns:android="http://schemas.android.com/apk/res/android" |
16 xmlns:tools="http://schemas.android.com/tools" | 16 xmlns:tools="http://schemas.android.com/tools" |
17 tools:ignore="MergeRootFrame" | 17 tools:ignore="MergeRootFrame" |
18 android:layout_width="0dp" | 18 android:layout_width="0dp" |
19 android:layout_height="48dp" | 19 android:layout_height="48dp" |
20 android:layout_weight="1"> | 20 android:layout_weight="1"> |
21 | 21 |
22 <ImageView | 22 <ImageView |
23 android:id="@+id/button_icon" | 23 android:id="@+id/button_icon" |
24 android:layout_width="wrap_content" | 24 android:layout_width="wrap_content" |
25 android:layout_height="match_parent" | 25 android:layout_height="wrap_content" |
26 android:layout_marginStart="8dp" | 26 android:layout_marginStart="8dp" |
27 android:layout_gravity="start|center_vertical" | 27 android:layout_gravity="start|center_vertical" |
28 android:maxWidth="48dp" | 28 android:adjustViewBounds="true" |
| 29 android:maxHeight="32dp" |
| 30 android:maxWidth="32dp" |
29 android:contentDescription="@null" | 31 android:contentDescription="@null" |
30 android:scaleType="centerInside"/> | 32 android:scaleType="centerInside"/> |
31 | 33 |
32 <Button | 34 <Button |
33 android:id="@+id/button" | 35 android:id="@+id/button" |
34 android:layout_width="match_parent" | 36 android:layout_width="match_parent" |
35 android:layout_height="match_parent" | 37 android:layout_height="match_parent" |
36 android:ellipsize="end" | 38 android:ellipsize="end" |
37 android:gravity="start|center_vertical" | 39 android:gravity="start|center_vertical" |
38 android:paddingStart="8dp" | 40 android:paddingStart="8dp" |
39 android:singleLine="true" | 41 android:singleLine="true" |
40 android:textSize="13sp" | 42 android:textSize="13sp" |
41 style="@style/WebNotificationButton"/> | 43 style="@style/WebNotificationButton"/> |
42 | 44 |
43 </FrameLayout> | 45 </FrameLayout> |
OLD | NEW |