android - How to disable click listener of button if there is overlay -
i using frame layout , linear layout overlay, when click on overlay button click listener invoked, kindly allow me know how handle this.
<linearlayout android:id="@+id/loglayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:background="@color/transparentblack" android:orientation="vertical" > <com.valspals.classes.buttonstylem700 android:id="@+id/logdone" android:layout_width="325dp" android:layout_height="35dp" android:layout_gravity="center" android:layout_margintop="25sp" android:background="@drawable/btn_confirm_normal" android:text="@string/iamdone" android:textcolor="@color/white" android:textsize="@dimen/normaltextsize" /> <com.valspals.classes.buttonstylem700 android:id="@+id/woops" android:layout_width="325dp" android:layout_height="35dp" android:layout_gravity="center" android:layout_margintop="15sp" android:layout_marginbottom="25dp" android:background="@drawable/btn_confirm_normal" android:text="@string/woops" android:textcolor="@color/white" android:textsize="@dimen/normaltextsize" /> </linearlayout>
above there frame layout, parent layout. behind layout have 2 buttons , problem click able linear layout overlay
there several options utilize this. easiest setting global variable , checking when onclick
called.
i.e. have boolean overlayshowing = false;
in event listener, check !overlayshowing
however, still allow button's click animation show. if want prevent well, intercept touch events on top layout (your framelayout) , prevent them beingness passed below layouts if overlay visible.
e.g. in overridden framelayout:
@override public boolean onintercepttouchevent(motionevent e){ homecoming overlayshowing; }
this intercept touch event , prevent passing on chain when overlay showing.
if overlay shown toggling view's visibility, simplify farther checking framelayout's visibility in onintercepttouchevent() method. e.g.
@override public boolean onintercepttouchevent(motionevent e){ homecoming getvisibility() == view.visible; }
android layout
No comments:
Post a Comment