/** * Created by Andy on 2018/2/9. * 透明可穿透事件WebView */ public class MWebView extends WebView { public MWebView(Context context) { super(context); setBackgroundColor(0); // 设置webview透明 } public MWebView(Context context, AttributeSet attrs) { super(context, attrs); setBackgroundColor(0); // 设置webview透明 } public MWebView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setBackgroundColor(0); // 设置webview透明 } /** * 事件分发,这样处理后可以使被Webview覆盖的组件相应点击事件 * * @param event * @return */ @Override public boolean onTouchEvent(MotionEvent event) { return false; } }