I use an overlay view that covers most of the screen. However, I received user reports that they could not click the INSTALL button in the package manager when installing third-party APKs.
Is there any way to get rid of this problem? I was thinking something about using BroadcastReceiver to catch ACTION_VIEW, but this seems impossible, as this is an Action action
I leave my class and xml layout file for reference:
public class OverlayView extends RelativeLayout{
private ImageView mImageView;
public OverlayView(ServiceOverlay overlayService) {
super(overlayService);
load();
mImageView = (ImageView) findViewById(R.id.backgroundimg);
}
public void destroy() {
final WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
wm.removeView(this);
}
private void load() {
LayoutInflater.from(getContext()).inflate(R.layout.overlay, this);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
0x50728,
-3);
params.gravity = Gravity.CENTER;
((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).addView(this, params);
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical"
android:paddingTop="0.0dip"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="0.0dip"
android:adjustViewBounds="false"
android:windowActionBarOverlay="true"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView android:id="@+id/backgroundimg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/bg2"
android:dither="false"
android:scaleType="fitXY"
android:windowActionBarOverlay="true" />
</LinearLayout>
source
share