这是我的布局:
<?xml version="1.0" encoding="utf-8"?><!-- Style Theme.Transparent -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayoutVideo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:weightSum="1"
android:focusable="true"
android:clickable="true">
<VideoView
android:id="@+id/videoView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.75"
android:clickable="true"
android:focusable="true" />
</LinearLayout>
我给父视图和子视图设置了onclicklistener:
linearLayout.setOnClickListener(myOnlyhandler);
videoView.setOnClickListener(myOnlyhandler);
我只收到视频视图的点击事件。 我想知道用户是在视频视图内部还是外部(父级)进行点击,并执行不同的操作。我该如何实现这个功能?
谢谢 Tata