1

I have this ListView whose items i'd like to hide depending on the selection of a RadioGroup. Currently I'm passing a boolean to the ListAdapter due to the RadioGroup having only two options. My items contain a checkbox and i want to either show the entire list or just the ones with the check boxes checked. I'm succeeding at hiding the items but the dividers still show, how can i fix this?

Look how it looks like

http://www.mediafire.com/i/?wa2s0ngq027vjwr

http://www.mediafire.com/i/?9i6ggj2fdsns2da

(I'm new, so i can't upload images here)

The xml for my row would be:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="1dip" android:gravity="center_vertical" android:background="#FFF"> <CheckBox android:id="@+id/dispositivo_tv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:textSize="15dip" android:layout_alignParentLeft="true" /> <LinearLayout android:id="@+id/botones" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentRight="true" android:gravity="center_vertical"> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button_foto" android:src="@drawable/camera" android:background="#FFF" android:paddingRight="15dip" android:visibility="invisible"></ImageButton> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button_comentario" android:src="@drawable/comment_add" android:background="#FFF" android:paddingRight="15dip"></ImageButton> </LinearLayout> </RelativeLayout> 

and the xml block for the ListView would be:

<LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:padding="5dip" android:background="@layout/list_box"> <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:cacheColorHint="#00000000" android:headerDividersEnabled="false" android:footerDividersEnabled="false </ListView> </LinearLayout> 

and what i use to hide the row when the boolean i told you about is set FALSE is:

wrapper.getDispositivo().setVisibility(View.GONE); wrapper.getFoto().setVisibility(View.GONE); wrapper.getComentario().setVisibility(View.GONE); 

PS: wrapper is the instance of the class where i have all the elements of the row, i.e. the checkbox (getDispositivo()), and a couple of image buttons (getFoto(), getComentario())

Thanks in advance...

6
  • We can't read your mind. You should write some code and more details. Commented Sep 16, 2011 at 13:57
  • myListIvew.setDividerHeight(0); Commented Sep 16, 2011 at 13:58
  • Have a look at this question stackoverflow.com/questions/2749551/… Commented Sep 16, 2011 at 14:23
  • @Soner I just edited my post with a little more detail Commented Sep 16, 2011 at 16:10
  • @superM That actually erase all of my dividers, i just want to hide the dividers of the rows i'm hidding Commented Sep 16, 2011 at 16:11

1 Answer 1

1

How about using custom dividers in your relative layout and setDivider(null); so once you hide the layout the dividers are hidden as well. I wanted to actually add this as a comment. But it comes only after 50 reps so had to put it as a answer.

Sign up to request clarification or add additional context in comments.

3 Comments

i mean something like a <View layout:alignParentBottom /> in the <RelativeLayout />
Actually I resolve this by using Android filters, thanks for your answer anyway.
Bricktop please add it as a answer so someone looking for it will be helped.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.