Mau*_*ycy 6 android android-listview
所以我很快就得到了一个带有自定义适配器的listView,并且它包含了一个包含horizontalScrollView以及textview等的视图.我遇到的问题是,当我尝试将一个监听器附加到此listView时,它没有收到任何回调.
我认为这个问题与我的列表项包含一个拦截点击事件的滚动视图这一事实有关(虽然我认为它应该只拦截其他手势).
code ...(我的列表项xml)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearMain"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/grey" >
<TextView
android:id="@+id/headerName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:padding="4dp"
android:textColor="@color/text_header"
android:textStyle="bold"
android:text="TextView" />
</RelativeLayout>
<View
android:background="@color/border"
android:layout_width="fill_parent"
android:layout_height="1px" />
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="fill_parent"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/linearImages"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:padding="4dp">
</LinearLayout>
</HorizontalScrollView>
<View
android:background="@color/border"
android:layout_width="fill_parent"
android:layout_height="1px" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
然后在我的onCreate ...
lv.setAdapter(myobj.adapter);
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener(){
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
Log.w("dsdsds", "sdsdsds");
}});
Run Code Online (Sandbox Code Playgroud)
任何帮助或建议将不胜感激
| 归档时间: |
|
| 查看次数: |
3371 次 |
| 最近记录: |