这里我有一个视图分页器活动,它有一个imageview和2个覆盖条.我使用android xml文件布局本身制作了覆盖条.
我的要求就是这样
1)第一次单击视图寻呼机的imageview =显示顶部和底部矩形覆盖栏.2)第二次单击视图寻呼机的imageview =隐藏这些叠加.
这两个都是像android gallary视图类型的功能.
但是,当这时显示这些顶部和底部布局栏时,我只想使用按钮,只需单击此布局中声明的按钮.
但是我没有成功实现这个目标.
问题
1)什么时候top or bottom bar如果我可以点击next or previous按钮而不是它后面的imageview单击触摸事件的事件,我的酒吧变得不可见.2)只需要声明按钮事件3)当我触摸覆盖条时,避免单击视图.
简而言之,当我的顶部和底部图像条出现时,从顶部和底部图像条没有发生图像查看事件.我可以点击imageview,但是当我实际点击下一个或上一个或分享按钮时,我不能点击.
所以这些是我面临的问题,请帮助我.
源代码 :
activity_pager_image.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<RelativeLayout
android:id="@+id/rl_top_overlay"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/slideshow_bar"
android:visibility="gone" >
<TextView
android:id="@+id/tv_top_overlay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textIsSelectable="false" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_bottom_overlay"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/slideshow_bar"
android:visibility="visible" >
<Button
android:id="@+id/btn_left_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="35dp"
android:background="@drawable/ic_left_arrow" />
<Button
android:id="@+id/btn_below_share"
style="@style/normalText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="35dp" …Run Code Online (Sandbox Code Playgroud) android android-layout android-gui android-viewpager android-framelayout
具体使用下面的代码,有没有办法修改它,以便这个新创建的视图下的活动不会收到任何手势?
View v1 = new View(this);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
1000,
50,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
PixelFormat.OPAQUE);
params.gravity = Gravity.BOTTOM;
WindowManager wm = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);
wm.addView(v1, params);
Run Code Online (Sandbox Code Playgroud) 我已经使用 WindowManager 绘制了一个叠加层。它的宽度和高度
WindowManager.LayoutParams.MATCH_PARENT具有透明背景。
我的视图必须匹配父级和处理圆触摸侦听器并将其余触摸传递到下面的屏幕
我有两个小circle in left and right corner。我让它们在屏幕上可拖动,效果很好。但是当我点击可见的主屏幕按钮时。WindowManager 不允许可见项目可点击。
int LAYOUT_FLAG = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ? WindowManager.
LayoutParams.TYPE_APPLICATION_OVERLAY : WindowManager.LayoutParams.TYPE_PHONE;
final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,//changed it to full
WindowManager.LayoutParams.MATCH_PARENT,
LAYOUT_FLAG,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
|WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
///| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, this flag can make it in touchable.
///WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
PixelFormat.TRANSLUCENT);
mFloatingView = LayoutInflater.from(this).inflate(R.layout.item_circle_dragging, null);
mFloatingView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
return false;
}
});
//Add the view to the window
mWindowManager = …Run Code Online (Sandbox Code Playgroud)