第一個參數(shù)傳的是自定義view,我想實現(xiàn)通過判斷自定義view里的一個布爾類型的屬性來給onTouch方法不同的返回值??墒羌t框那里要怎么寫?我試圖用instanceof來判斷v是否為自定義view的實例??墒且恢狈祷豧alse。
歡迎選擇我的課程,讓我們一起見證您的進(jìn)步~~
Suggestion: You print the view ID and see if it is the same as the view ID when you created the popupwindows; it feels like this view does not represent the view you clicked.
You can use debug to check the type of View. If you want to set the onTouch event of popupWindow, why not write it directly in the popupWindow class. In this case, you can directly set the view for a desired view. Implemented onTouch
If instanceof does not hold, it may not be an event received by the custom view. You can analyze it from this aspect. If so, type conversion after instanceof is no problem and can be handled like this