如何让listView的各个item变为不可点击
3个回答
2015-05-24 · 知道合伙人数码行家
关注
展开全部
1. 如果是listView的id是使用系统默认的id,如下, 则可以在实现此listView的adapter里override isEnabled()方法:
[html] view plaincopy
<ListView android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:transcriptMode="alwaysScroll"
android:layout_weight="1"
/>
[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);
[html] view plaincopy
<ListView android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:transcriptMode="alwaysScroll"
android:layout_weight="1"
/>
[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);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2014-12-09
展开全部
1. 如果是listView的id是使用系统默认的id,如下, 则可以在实现此listView的adapter里override isEnabled()方法:
[html] view plaincopy
<ListView android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:transcriptMode="alwaysScroll"
android:layout_weight="1"
/>
[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);
[html] view plaincopy
<ListView android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:transcriptMode="alwaysScroll"
android:layout_weight="1"
/>
[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);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2014-12-09
展开全部
Jsp里面:
<input type="checkbox" id="showInput" disabled="disabled" onclick="showInput();"/>
<input id="showInputGoGoGo"/>
Js里面:
function showInput() {
var check = document.getElementById('showInputGoGoGo');
if(check.checked==true){
document.getElementById('showInputGoGoGo').style.display='block';
}
}
<input type="checkbox" id="showInput" disabled="disabled" onclick="showInput();"/>
<input id="showInputGoGoGo"/>
Js里面:
function showInput() {
var check = document.getElementById('showInputGoGoGo');
if(check.checked==true){
document.getElementById('showInputGoGoGo').style.display='block';
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询