我有一个有趣的问题。
当用户接到电话时,我会向他们显示一个文本,我正在使用TYPE_SYSTEM_OVERLAY
进行调用。
但在锁定屏幕上会出现第二个窗口!
Here's the image of the issue I'm having.
谢谢,
这是我的代码:
final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT
);
params.height = 150;
params.gravity = Gravity.CLIP_HORIZONTAL | Gravity.CENTER;
nm.this.getWindow().setAttributes(params);
WindowManager wm = (WindowManager) getApplicationContext().getSystemService(WINDOW_SERVICE);
TextView tv = new TextView (nm.this);
tv.setText ("Showing the error");
LinearLayout lo = new LinearLayout(nm.this);
lo.setOrientation(LinearLayout.VERTICAL);
lo.addView(tv);
wm.addView (lo, params);
我的清单文件:
<activity
android:name=".nm"
android:theme="@android:style/Theme.DeviceDefault.Dialog.NoActionBar"
android:label="@string/title_activity_nm" >
</activity>