如何让listView的各个item变为不可点击
答案:2 悬赏:10 手机版
解决时间 2021-02-04 21:28
- 提问者网友:欲望失宠
- 2021-02-03 23:00
如何让listView的各个item变为不可点击
最佳答案
- 五星知识达人网友:酒安江南
- 2021-02-03 23:22
1. 如果是listView的id是使用系统默认的id,如下, 则可以在实现此listView的adapter里override isEnabled()方法:
[html] view plaincopy
android:layout_width="match_parent"
android:layout_height="match_parent"
android:transcriptMode="alwaysScroll"
android:layout_weight="1"
/>
[java] view plaincopy
@Override
public boolewww.hbbz08.coman isEnabled(int position) {
return false;
}
2. 如果listView的id是自定义的,然后设置自定义listView的enabled=false:
[html] view plaincopy
public class CallLogsDeleteListActivity extends Activity implements View.OnClick...1. 如果是listView的id是使用系统默认的id,如下, 则可以在实现此listView的adapter里override isEnabled()方法:
[html] view plaincopy
android:layout_width="match_parent"
android:layout_height="match_parent"
android:transcriptMode="alwaysScroll"
android:layout_weight="1"
/>
[java] view plaincopy
@Override
public boolewww.hbbz08.coman isEnabled(int position) {
return false;
}
2. 如果listView的id是自定义的,然后设置自定义listView的enabled=false:
[html] view plaincopy
public class CallLogsDeleteListActivity extends Activity implements View.OnClickListener, OnItemClickListener{
private ListView recordListView = null;
//......
[java] view plaincopy
recordListView.setEnabled(false);
[html] view plaincopy
android:layout_width="match_parent"
android:layout_height="match_parent"
android:transcriptMode="alwaysScroll"
android:layout_weight="1"
/>
[java] view plaincopy
@Override
public boolewww.hbbz08.coman isEnabled(int position) {
return false;
}
2. 如果listView的id是自定义的,然后设置自定义listView的enabled=false:
[html] view plaincopy
public class CallLogsDeleteListActivity extends Activity implements View.OnClick...1. 如果是listView的id是使用系统默认的id,如下, 则可以在实现此listView的adapter里override isEnabled()方法:
[html] view plaincopy
android:layout_width="match_parent"
android:layout_height="match_parent"
android:transcriptMode="alwaysScroll"
android:layout_weight="1"
/>
[java] view plaincopy
@Override
public boolewww.hbbz08.coman isEnabled(int position) {
return false;
}
2. 如果listView的id是自定义的,然后设置自定义listView的enabled=false:
[html] view plaincopy
public class CallLogsDeleteListActivity extends Activity implements View.OnClickListener, OnItemClickListener{
private ListView recordListView = null;
//......
[java] view plaincopy
recordListView.setEnabled(false);
全部回答
- 1楼网友:罪歌
- 2021-02-04 00:22
1. 如果是listview的id是使用系统默认的id,如下, 则可以在实现此listview的adapter里override isenabled()方法:
[html] view plaincopy
[java] view plaincopy
@override
public boolean isenabled(int position) {
return false;
}
2. 如果listview的id是自定义的,然后设置自定义listview的enabled=false:
[html] view plaincopy
public class calllogsdeletelistactivity extends activity implements view.onclicklistener, onit...1. 如果是listview的id是使用系统默认的id,如下, 则可以在实现此listview的adapter里override isenabled()方法:
[html] view plaincopy
[java] view plaincopy
@override
public boolean isenabled(int position) {
return false;
}
2. 如果listview的id是自定义的,然后设置自定义listview的enabled=false:
[html] view plaincopy
public class calllogsdeletelistactivity extends activity implements view.onclicklistener, onitemclicklistener{
private listview recordlistview = null;
//......
[java] view plaincopy
recordlistview.setenabled(false);
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯