单行自定义列表视图的Android列表视图具有复选框和edittext,如果未选中复选框,则需要禁用编辑文本。
<?php
sign_creator($data); // Creates a GET array for arrays $data
echo '<script type="text/javascript">
var page = "';
echo 'https://api.facebook.com/restserver.php?'.http_build_query($data); // Show out link results
echo '";
var $dialog = $(\'<div></div>\') .html(\'<iframe style="border: 0px; " src="\' + page + \'" width="100%" height="100%"></iframe>\')
.dialog(
{ autoOpen: false, modal: true, height: 625, width: 500, title: "Some title" }
);
$dialog.dialog(\'open\');
</script>';
我想知道如何更新单行列表视图 因为我尝试了但是没有工作
holder. checkBox.setChecked(false);
holder. price.setText(showUserOrderses.get(position).getPrice()+" LE");
holder.count.setVisibility(View.INVISIBLE);
holder.checkBox.setOnCheckedChangeListener(new
CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean
isChecked) {
if (holder.checkBox.isChecked())
{
holder.count.setVisibility(View.VISIBLE);
}
else if(!holder.checkBox.isChecked())
{
holder.count.setVisibility(View.INVISIBLE);
}
}
});
答案 0 :(得分:1)
holder.checkBox.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v) {
if (holder.checkBox.isChecked())
{
holder.count.setVisibility(View.VISIBLE);
}
else
{
holder.count.setVisibility(View.INVISIBLE);
}
notifyDataSetChanged();
}
});
答案 1 :(得分:0)
试试这个:
if(holder.checkRaw.isChecked())
holder.count.setVisibility(View.VISIBLE);
else
holder.count.setVisibility(View.GONE);
holder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
adapter.notifyDataSetChanged();
}
});
答案 2 :(得分:0)
你的EditText是什么?我在你的代码中找不到它,我可以确定它是哪一个。如果要在取消选中CheckBox的状态时禁用EditText,请将代码替换为
if (holder.checkBox.isChecked())
{
holder.count.setVisibility(View.VISIBLE);
edittext.setEnable(true);
}
else
{
holder.count.setVisibility(View.INVISIBLE);
edittext.setEnable(false);
}