11<?xml version =" 1.0" encoding =" utf-8" ?>
2- <LinearLayout xmlns : android =" http://schemas.android.com/apk/res/android"
3- android : id =" @+id/banner_root"
2+ <!--
3+ Lưu ý: view này được dùng làm Toast.view (xem BannerNotificationManager.kt).
4+ Toast KHÔNG đặt view vào trong 1 ViewGroup cha khi hiển thị, nên các thuộc tính
5+ layout_margin... trên view gốc sẽ bị bỏ qua hoàn toàn. Vì vậy phải dùng 1 FrameLayout
6+ ngoài cùng với padding (padding luôn có tác dụng, không phụ thuộc parent) để tạo
7+ khoảng cách với mép màn hình, thay vì đặt margin trực tiếp lên banner_root.
8+ -->
9+ <FrameLayout xmlns : android =" http://schemas.android.com/apk/res/android"
410 android : layout_width =" match_parent"
511 android : layout_height =" wrap_content"
6- android : orientation =" horizontal"
7- android : gravity =" center_vertical"
8- android : background =" @drawable/banner_bg"
9- android : elevation =" 8dp"
10- android : layout_marginStart =" 16dp"
11- android : layout_marginEnd =" 16dp"
1212 android : paddingStart =" 16dp"
13- android : paddingEnd =" 16dp"
14- android : paddingTop =" 14dp"
15- android : paddingBottom =" 14dp" >
16-
17- <ImageView
18- android : id =" @+id/banner_icon"
19- android : layout_width =" 24dp"
20- android : layout_height =" 24dp"
21- android : layout_gravity =" top"
22- android : src =" @drawable/ic_banner_info" />
13+ android : paddingEnd =" 16dp" >
2314
2415 <LinearLayout
25- android : layout_width =" 0dp"
16+ android : id =" @+id/banner_root"
17+ android : layout_width =" match_parent"
2618 android : layout_height =" wrap_content"
27- android : layout_weight =" 1"
28- android : layout_marginStart =" 12dp"
29- android : orientation =" vertical" >
19+ android : orientation =" horizontal"
20+ android : gravity =" center_vertical"
21+ android : background =" @drawable/banner_bg"
22+ android : elevation =" 8dp"
23+ android : paddingStart =" 16dp"
24+ android : paddingEnd =" 16dp"
25+ android : paddingTop =" 14dp"
26+ android : paddingBottom =" 14dp" >
3027
31- <TextView
32- android : id =" @+id/banner_title"
33- android : layout_width =" match_parent"
34- android : layout_height =" wrap_content"
35- android : textColor =" @android:color/white"
36- android : textSize =" 15sp"
37- android : textStyle =" bold"
38- android : visibility =" gone" />
28+ <ImageView
29+ android : id =" @+id/banner_icon"
30+ android : layout_width =" 24dp"
31+ android : layout_height =" 24dp"
32+ android : layout_gravity =" top"
33+ android : src =" @drawable/ic_banner_info" />
3934
40- <TextView
41- android : id =" @+id/banner_message"
42- android : layout_width =" match_parent"
35+ <LinearLayout
36+ android : layout_width =" 0dp"
4337 android : layout_height =" wrap_content"
44- android : layout_marginTop =" 2dp"
45- android : textColor =" @android:color/white"
46- android : textSize =" 14sp"
47- android : maxLines =" 4" />
38+ android : layout_weight =" 1"
39+ android : layout_marginStart =" 12dp"
40+ android : orientation =" vertical" >
41+
42+ <TextView
43+ android : id =" @+id/banner_title"
44+ android : layout_width =" match_parent"
45+ android : layout_height =" wrap_content"
46+ android : textColor =" @android:color/white"
47+ android : textSize =" 15sp"
48+ android : textStyle =" bold"
49+ android : visibility =" gone" />
50+
51+ <TextView
52+ android : id =" @+id/banner_message"
53+ android : layout_width =" match_parent"
54+ android : layout_height =" wrap_content"
55+ android : layout_marginTop =" 2dp"
56+ android : textColor =" @android:color/white"
57+ android : textSize =" 14sp"
58+ android : maxLines =" 4" />
59+ </LinearLayout >
60+
4861 </LinearLayout >
4962
50- </LinearLayout >
63+ </FrameLayout >
0 commit comments