Android 如何在EditText事件上模糊背景布局

Android 如何在EditText事件上模糊背景布局,android,android-layout,android-fragments,android-view,Android,Android Layout,Android Fragments,Android View,我目前遇到了一个困难,我想在单击我的EditText时模糊(更改alpha也可以)背景(除了我的EditText)并在离开后恢复正常 有人遇到过这个问题吗 我曾尝试将FrameLayout放入父级,将其alpha设置为0.7f,并在EditText聚焦时将EditText置于前面,但我没有得到预期的结果 这里是我的布局的层次结构: 相对{ 图像视图 线性布局 } 我认为这是不可能的。但是如果我是你,我会在EditText的onClickListener中创建一个CustomAlertDiaglo

我目前遇到了一个困难,我想在单击我的
EditText
时模糊(更改alpha也可以)背景(除了我的
EditText
)并在离开后恢复正常

有人遇到过这个问题吗

我曾尝试将FrameLayout放入父级,将其alpha设置为0.7f,并在EditText聚焦时将
EditText
置于前面,但我没有得到预期的结果

这里是我的布局的层次结构:

相对{

图像视图

线性布局

}


我认为这是不可能的。但是如果我是你,我会在
EditText
onClickListener
中创建一个
CustomAlertDiaglog
,其中只包含
EditText
字段。这将自动显示在弹出窗口中,背景中的所有视图都将变暗


下面是如何使用
CustomAlertDialog

使用此功能模糊输入位图图像的好方法:

 Bitmap BlurImage(Bitmap input) {
            RenderScript rsScript = RenderScript.create(this);
            Allocation alloc = Allocation.createFromBitmap(rsScript, input);

            ScriptIntrinsicBlur blur = ScriptIntrinsicBlur.create(rsScript, alloc.getElement());
            blur.setRadius(12);
            blur.setInput(alloc);

            Bitmap result = Bitmap.createBitmap(input.getWidth(), input.getHeight(), input.getConfig());
            Allocation outAlloc = Allocation.createFromBitmap(rsScript, result);
            blur.forEach(outAlloc);
            outAlloc.copyTo(result);

            rsScript.destroy();
            return result;
        }

最后找到的解决方案是将我所有的小部件放在同一个relativeLayout中,这样我就可以“玩”z索引,当我收到一个点击时,将Edittext放在前面,然后将其和setAlpha放在用于隐藏背景的FrameLayout中


感谢您的回答:)

在发布与我要求的代码不符的代码之前,请您先阅读问题。这不是我想要做的,我想让我的表单具有交互性,就像当用户单击一个字段时,编辑文本将移到所有其他视图之上,它与其他视图非常不同。我想复制一个功能,我在网站上,但我的申请表。你明白我想做什么吗?
 Bitmap BlurImage(Bitmap input) {
            RenderScript rsScript = RenderScript.create(this);
            Allocation alloc = Allocation.createFromBitmap(rsScript, input);

            ScriptIntrinsicBlur blur = ScriptIntrinsicBlur.create(rsScript, alloc.getElement());
            blur.setRadius(12);
            blur.setInput(alloc);

            Bitmap result = Bitmap.createBitmap(input.getWidth(), input.getHeight(), input.getConfig());
            Allocation outAlloc = Allocation.createFromBitmap(rsScript, result);
            blur.forEach(outAlloc);
            outAlloc.copyTo(result);

            rsScript.destroy();
            return result;
        }