我有一个列表视图,我从基础适配器获取值。我希望点击按钮时,其属性不可见的复选框变得可见并且出现在列表视图的每一行前面。我能够去做这件事,但只有几行前的复选框。我厌倦了搜索这个东西。我觉得问题是在获取列表视图的某个地方,它只获取当时在屏幕上可见的行的视图。因为我在这个领域很新,我无法获得我确切的问题。任何帮助将是非常可观的。如何把复选框放在listview的每一行中?
///复选框两行的缺口后出现在四行然后再等..///
button.setOnClickListener(this);
public void onClick(View v) {
// TODO Auto-generated method stub
//relative layout in which button is declared
RelativeLayout relative=(RelativeLayout)v.getParent();
//listview is first child of relative..
ListView lv=(ListView)relative.getChildAt(1);
for(int i=0;i<lv.getChildCount();i++){
////////relative layout in whichcheckbox is declared
RelativeLayout newrelative=(RelativeLayout)lv.getChildAt(i);
//checkbox is forth child of newrelative..
CheckBox cb=(CheckBox)newrelative.getChildAt(4);
cb.setVisibility(0);
}
}//method
可能重复的[如何添加一个复选框在列表视图?](http://stackoverflow.com/questions/2538539/how-to-add-a-checkbox-in-a-listview) –
嗨有发现这个任何解决方案..如果是,然后重播我.. –