android - 在 AlertDialog 上复制/粘贴带有奇怪矩形的菜单

标签 android android-alertdialog

我正在使用此自定义 View 创建一个 AlertDialog:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</LinearLayout>

这是我用来创建和显示对话框的代码:

AlertDialog.Builder builder;
builder = new AlertDialog.Builder(getActivity());

LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View dialogView = inflater.inflate(R.layout.edit_text_layout, null);
builder.setView(dialogView);
builder.create().show();

当我尝试从 EditText 复制一些文本时,复制/粘贴菜单会出现一个奇怪的矩形,隐藏了 EditText。

enter image description here

我已经在棉花糖和牛轧糖上进行了测试,两者都有相同的问题

最佳答案

正如它提到的here ,问题与​​样式有关。在这种情况下,从我的自定义 AlertDialog 样式中删除 backgkround 颜色项目解决了问题。

关于android - 在 AlertDialog 上复制/粘贴带有奇怪矩形的菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44888366/

相关文章:

android - 使用 alertdialog 构建器的 setCursor 方法显示数据库中的项目列表时如何添加多个列?

android - 当我们在 AlertDialog.Builder 中将 getApplicationContext() 作为参数写入时,为什么 android 会报错?

android - RecyclerView View 中的 EditText 在键盘打开时分离

java - W/System.err : java.net.ConnectException:连接超时

android - ARCore SceneForm HDR 房间图像

android - 如何显示来自非 UI 类的警报对话框?出现错误 - 无法在未调用 Looper.prepare() 的线程内创建处理程序

java - 在 Android 的 AlertDialog 中超链接电话号码

android - 如何在 Android Studio 中复制和重命名项目

android - 我可以在 'res' 文件夹中添加哪些文件夹?

android - 如何从android中的警报对话框添加字符串?