Skip to content

Commit a90c926

Browse files
committed
Card elevation bug was fixed
1 parent 592f508 commit a90c926

File tree

3 files changed

+40
-32
lines changed

3 files changed

+40
-32
lines changed

materialtoast/src/main/java/com/marcoscg/materialtoast/MaterialToast.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void show() {
7474
final PopupWindow toast = getToast(activity, icon);
7575

7676
if (toast != null && activity.getWindow() != null) {
77-
toast.showAtLocation(activity.getWindow().getDecorView(), Gravity.BOTTOM, 0, 100);
77+
toast.showAtLocation(activity.getWindow().getDecorView(), Gravity.BOTTOM, 0, activity.getResources().getDimensionPixelSize(R.dimen.mt_bottom_margin));
7878
}
7979

8080
new Handler().postDelayed(new Runnable() {

materialtoast/src/main/res/layout/mt_main_layout.xml

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,48 @@
77
~ Last modified 21/12/18 18:30.
88
-->
99

10-
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
10+
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
1111
xmlns:app="http://schemas.android.com/apk/res-auto"
12-
android:id="@+id/card_view"
1312
android:layout_width="wrap_content"
14-
android:layout_height="wrap_content"
15-
app:cardCornerRadius="4dp"
16-
app:cardElevation="4dp"
17-
app:contentPaddingTop="8dp"
18-
app:contentPaddingBottom="8dp"
19-
app:contentPaddingLeft="12dp"
20-
app:contentPaddingRight="12dp">
21-
22-
<LinearLayout
13+
android:layout_height="wrap_content">
14+
15+
<androidx.cardview.widget.CardView
16+
android:id="@+id/card_view"
2317
android:layout_width="wrap_content"
2418
android:layout_height="wrap_content"
25-
android:gravity="center_vertical"
26-
android:orientation="horizontal">
27-
28-
<androidx.appcompat.widget.AppCompatImageView
29-
android:id="@+id/icon"
30-
android:layout_width="24dp"
31-
android:layout_height="24dp"
32-
android:layout_marginRight="8dp"
33-
android:layout_marginEnd="8dp"
34-
android:scaleType="fitCenter"
35-
android:visibility="gone"/>
36-
37-
<androidx.appcompat.widget.AppCompatTextView
38-
android:id="@android:id/message"
39-
android:layout_width="match_parent"
19+
android:layout_margin="8dp"
20+
app:cardCornerRadius="4dp"
21+
app:cardElevation="4dp"
22+
app:contentPaddingTop="8dp"
23+
app:contentPaddingBottom="8dp"
24+
app:contentPaddingLeft="12dp"
25+
app:contentPaddingRight="12dp">
26+
27+
<LinearLayout
28+
android:layout_width="wrap_content"
4029
android:layout_height="wrap_content"
41-
android:textAppearance="@style/TextAppearance.AppCompat.Small"
42-
android:textSize="@dimen/mt_text_size"
43-
android:textColor="@android:color/black"/>
30+
android:gravity="center_vertical"
31+
android:orientation="horizontal">
32+
33+
<androidx.appcompat.widget.AppCompatImageView
34+
android:id="@+id/icon"
35+
android:layout_width="24dp"
36+
android:layout_height="24dp"
37+
android:layout_marginRight="8dp"
38+
android:layout_marginEnd="8dp"
39+
android:scaleType="fitCenter"
40+
android:visibility="gone"/>
41+
42+
<androidx.appcompat.widget.AppCompatTextView
43+
android:id="@android:id/message"
44+
android:layout_width="match_parent"
45+
android:layout_height="wrap_content"
46+
android:textAppearance="@style/TextAppearance.AppCompat.Small"
47+
android:textSize="@dimen/mt_text_size"
48+
android:textColor="@android:color/black"/>
49+
50+
</LinearLayout>
4451

45-
</LinearLayout>
52+
</androidx.cardview.widget.CardView>
4653

47-
</androidx.cardview.widget.CardView>
54+
</FrameLayout>

materialtoast/src/main/res/values/dimens.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99

1010
<resources>
1111
<dimen name="mt_text_size">16sp</dimen>
12+
<dimen name="mt_bottom_margin">48dp</dimen>
1213
</resources>

0 commit comments

Comments
 (0)