Overlaying a view does not disable actions on underlying view - android

I have 2 views : View A and view B. View A is rendered and has actions to input a text value. Im displaying an overlay view - View B on top of this. I expect that the actions on View A get disabled but they do not and im still able to type in the input field on View A. How can i disable this ?

The reason is that your overlay is not consuming the touch events , so by design if a view is not consuming touch events the events are passed to underlying view in the view model. So the long answer is make your overlay touchable, focusable , and touch listener and return true . short answer is add android:clickable="true" to your overlay view.

Related

Invisible views detection on motion event

As i already tried views with motion drag reading Android docs.
I have clearly not saying about basics of it but i want to hide orinvisible view which will be visible when other view which is being dragged or using motion can taken to the hidden orinvisible surface area ?
Set tag of to view and after that when you touch view check tag of that view in MotionEvent.ACTION_DOWN or MotionEvent.ACTION_MOVE and set View.setVisibility(View.INVISIBLE) for other views.
I think it should be easy using transparent color for this View. Even you will use ViewGroup with other elements, you can just create method for updating parameters (like background, color, image, etc.) to the transparent type.

top view's touch also works it's bottom view's touch

Hi I am facing such issue,
I have two view for example my first view is A which's image is below
and I am opening View B on this A view
In view B when i touch the area where there is no button for example
it's affect to View A, means A view's button clicked, how to avoid this can any body help?
thanks
Since the background of the keyboard isn't clickable it goes through to the next layer. Simply set the background/panel of the keyboard as clickable by android:clickable="true", this will prevent the lower layer from being clicked.

how to get the all child id in viewgroup touch listener?

how to getting the all child id from View group touch listener ?
and
at a time one child focus on touch down and then other child view focus to gone in view group..i already complete the scale and rotate and all operation. and also implement the touch listener but all the operation in touch so not getting the at a time one childview focus and show view in it.
i m add the view in Relative layout and the Image view create the run time..
so i am confused to getting all

SlidingPaneLayout - touch event is delegated to the view behind

How can I avoid that my SlidingPaneLayout delegates the touch event to the behind view?
In my case, if a non touchable area like a textview is over a button and the behind view is not visible and I touch the textview, the button get's the touch event...
I know it's late, but for other people searching for the same issue:
I use
android:clickable="true"
in the xml of the view that is non-touchable. For example, if you have a FrameLayout corresponding to the detail pane, then set its clickable value to true. Then it won't pass the touch events to the view behind(master pane).

Drag and drop between views

I have a viewgroup with textviews that are added dynamically into the viewgroup. How would I add the ability to drag and drop a textview between other textviews.
Is there a way to detect what view you have dropped it over.
If it makes it easier the textviews could be buttons.
On API 11 and up, you can use the built in functionality:
https://developer.android.com/guide/topics/ui/drag-drop.html
On previous versions, you can also do it by hand:
In theory, you have to add an onTouchListener for your views, which on action down saves the touch position relative to the view position.
Then, on receiving a touch move event, you set the position of the view to reflect that.
On receiving up event, the user has dropped the view, you check the current coordinates and compare them to the other views, if it is before another view, you move that view up and set the position of the moved view to be in line with the others again.
You can limit the dragging to only x/only y by only changing those values.

Categories

Resources