【发布时间】:2012-02-08 20:52:53
【问题描述】:
我希望在我的应用程序上方有一个透明视图。
我只想知道当前的活动就想这样做。
我找到了一种通过 windowManager 添加新框架布局的方法
我正在这样做:
public static void AddViewAbove(Activity activity) {
FrameLayout newLayout = new FrameLayout(activity);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT,
WindowManager.LayoutParams.TYPE_APPLICATION,
// if I let WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
// then touchevent are passed to the application behind, but I cant handle touch in
// my new frameLayout
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
PixelFormat.TRANSLUCENT);
activity.getWindowManager().addView(newLayout , lp);
}
我现在的主要问题是我无法在我的新 FrameLayout 中以及同时在我的视图后面的应用程序中正确接收 touchevent。
【问题讨论】:
标签: android view transparent