0

My Android game (NativeActivity) opens a system dialog with an EditText field for text entry. The dialog opens fine and the text is editable, but when I select some text in order to cut/copy, the EditText context menu appears to draw outside its bounds and I don't understand why.

I've attached two images. The first one shows the dialog when it opens. The second one shows what happens when text is selected and the context menu pops open.

Dialog Box

EditText Context Menu

Here's my styles.xml file.

<resources>
<!-- Popup Dialog Theme -->
<style name="MyDialogTheme" parent="Theme.AppCompat.DayNight.Dialog.Alert">
 <item name="android:windowBackground">@color/MyDialogBackground</item>
 <item name="android:textColorHint">@color/MyDialogLabel</item>
 <item name="android:textColor">@color/MyDialogText</item>
 <item name="android:dialogCornerRadius">24dp</item>
 <item name="android:backgroundTint">@color/MyDialogBackground</item>
 <item name="android:backgroundTintMode">src_over</item>
 <item name="android:alpha">0.9</item>
</style>
asked Jul 10, 2025 at 0:12
2
  • How are you handling the theme for the Dialog? That looks like what happens when android:background is set in the theme, which causes that background to be set on every View. It's often confused for android:windowBackground. Commented Jul 10, 2025 at 0:19
  • 1
    Thanks Mike M. Your insight was spot-on. In this case I had defined backgroundTint and backgroundTintMode, assuming they'd apply to the window background. Commented Jul 10, 2025 at 1:22

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.