jeudi 19 février 2015

Refresh listview setvisible all checkbox

I have a listview with my custom row.xml. Row.xml has a checkbox, imageview, textview and an imageview.


By default, the checkbox is visibility:GONE in the row.xml


In the code, I override the next method:



@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);

checkBox=(CheckBox)findViewById(R.id.checkBox);
checkBox.setVisibility(View.VISIBLE);

myArrayAdapter.notifyDataSetChanged();

}

}


But only get one row visible. I tried everything with the code, but i can´t find the solution. Any idea?


Kisses ^^


EDIT with my custom_row.xml



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >

<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/checkBox"
android:checked="false"

android:visibility="gone"
/>

<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/image"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/text1"/>

<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:id="@+id/imageView"
android:src="@android:drawable/ic_menu_add"
/>
</LinearLayout>




Aucun commentaire:

Enregistrer un commentaire