【发布时间】:2015-02-23 03:38:49
【问题描述】:
我有以下问题。
在 Android 应用程序中,有一个自定义布局类,它扩展了 FrameLayout。它覆盖自定义实现的 onTouchEvent 方法。我们有一个 TextView 作为这个布局类的内容。我们希望这个 TextView 中的 URL 链接是可点击的。为此,我们将 'android:autoLink="web"' 添加到 TextView 的属性中。以下 Xml 随之而来:
<PinchZoomScrollView
android:layout_weight="350"
android:layout_width="0dp"
android:layout_height="match_parent"
android:id="@+id/newsDetailScrollView">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web"
android:id="@+id/newsDetailText"/>
</PinchZoomScrollView>
添加autoLink="web"后,似乎没有调用自定义布局类“PinchZoomEvent”的onTouchEvent。似乎具有 autoLink 属性的 TextView 以某种方式阻止了触摸事件。这很奇怪,因为 PinchZoomScrollView 是 TextView 的父级,它应该首先接收事件。在这种情况下应该怎么做?
【问题讨论】:
标签: android android-layout textview touch-event