From a29d2e9d3e3e256288279ae3c37a2cc7da0a0912 Mon Sep 17 00:00:00 2001 From: Kongzue Date: Tue, 26 Nov 2024 13:25:46 +0800 Subject: [PATCH] =?UTF-8?q?0.0.50.beta24=20pre=20-=20=E4=BF=AE=E5=A4=8DPop?= =?UTF-8?q?Menu=E5=9C=A8=E6=9C=AA=E7=BB=91=E5=AE=9AbaseView=E8=80=8C?= =?UTF-8?q?=E6=8C=87=E5=AE=9AsetAlignGravity=E4=BC=9A=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E7=9A=84=E7=A9=BA=E6=8C=87=E9=92=88=E5=BC=82=E5=B8=B8=EF=BC=9B?= =?UTF-8?q?=20-=20=E4=BF=AE=E5=A4=8DDialogListBuilder=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E7=A9=BA=E6=8C=87=E9=92=88=E9=A3=8E?= =?UTF-8?q?=E9=99=A9=EF=BC=9B=20-=20PopMenu=20=E5=A2=9E=E5=8A=A0=20setBack?= =?UTF-8?q?groundColor=20=E5=92=8C=20setBackgroundColorRes=20=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/kongzue/dialogx/dialogs/PopMenu.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopMenu.java b/DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopMenu.java index 4af3ac52..ce75b59d 100644 --- a/DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopMenu.java +++ b/DialogX/src/main/java/com/kongzue/dialogx/dialogs/PopMenu.java @@ -21,6 +21,8 @@ import android.widget.RelativeLayout; import android.widget.TextView; +import androidx.annotation.ColorInt; +import androidx.annotation.ColorRes; import androidx.annotation.Nullable; import androidx.lifecycle.Lifecycle; @@ -616,6 +618,9 @@ public void onClick(View v) { } else { boxRoot.setClickable(false); } + if (backgroundColor != null) { + tintColor(boxBody, backgroundColor); + } if (backgroundRadius > -1) { if (boxBody.getBackground() instanceof GradientDrawable) { @@ -1508,4 +1513,20 @@ public boolean isMenuItemEnable(int index) { } return enabled; } + + public int getBackgroundColor() { + return backgroundColor; + } + + public PopMenu setBackgroundColor(@ColorInt int backgroundColor) { + this.backgroundColor = backgroundColor; + refreshUI(); + return this; + } + + public PopMenu setBackgroundColorRes(@ColorRes int backgroundColorResId) { + this.backgroundColor = getColor(backgroundColorResId); + refreshUI(); + return this; + } }