【发布时间】:2015-02-24 08:50:35
【问题描述】:
我有一个列表视图。 ListView 的每一项都有HorizontalScrollview 和textview。水平滚动视图里面有图像。我正在使用 FrameLayout 在水平滚动视图(左侧)上显示文本视图。
我可以做到。但是当我点击 TextView 来调用 ListView 的 Long Click Listener 时,会触发 Image View 的 OnClick 事件。
这里是 ListView 项目 XML 文件。
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:id="@+id/linearLayoutListViewItem"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants"
android:orientation="horizontal"
>
<HorizontalScrollView
android:id="@+id/horizontalScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
>
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
>
<!-- Adding images here programmatically..-->
</LinearLayout>
</HorizontalScrollView>
<!-- Textview That i want to show on left side Above the images in HorizontalScrollview-->
<gallery.com.activity.CustomTextView
android:id="@+id/textview"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#a0000000"
android:gravity="center"
android:padding="7dp"
android:textSize="16dp"
>
</gallery.com.activity.CustomTextView>
</FrameLayout>
另外,这是我的 ListView XML 文件。
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">
<gallery.com.activity.DynamicListView
android:id="@+id/listView"
android:background="#0000"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
/>
</LinearLayout>
那么,我怎样才能调用 ListView 的 Long Click Listener 呢? 请帮忙。 如果您想进一步澄清这个问题,请告诉我。
【问题讨论】:
标签: android android-layout listview