2011-09-16 26 views
1

私はRadioGroupの選択に応じて非表示にしたいこのListViewを持っています。現時点では、RadioGroupは2つのオプションしかないため、ListAdapterにブール値を渡しています。私の項目にはチェックボックスがあり、リスト全体を表示するか、チェックボックスをオンにして表示するかを選択します。私はアイテムを隠すことに成功していますが、仕切りはまだ表示されます、どうすればこの問題を解決できますか?listview dividersを動的に非表示にする方法は?

は、それがどのように見えるか見て

よう

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

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

(私は新しいので、私はここに画像をアップロードすることはできません)

私の行のXMLは次のようになります。

<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> 

xmlブロックリストビューは、次のようになります。

<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> 

と私は私があなたに言ったブール値がFALSEに設定されている場合、行を非表示に使用することです:

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

PS:ラッパーは私が持っているクラスのインスタンスであります行のすべての要素は、チェックボックス(getDispositivo())、すなわち、画像のボタンのカップル(getFoto()、getComentario())事前に

おかげで...

+0

私たちはあなたの心を読むことができません。あなたはいくつかのコードと詳細を書く必要があります。 –

+0

myListIvew.setDividerHeight(0); – superM

+0

この質問をご覧くださいhttp://stackoverflow.com/questions/2749551/how-to-change-the-divider-height-of-listview-dynamically – Martyn

答えて

1

どのようにカスタムDを使用する方法についてあなたの相対レイアウトのividerとsetDivider(null);レイアウトを隠すと、仕切りも非表示になります。私は実際これをコメントとして追加したかったのです。しかし、それは50人の代理人の後に来るので、答えとしてそれを置かなければならなかった。

+0

の<レイアウトの表示:alignParentBottom />のようなものを意味します。 –

+1

実際には、これを解決するためにAndroidフィルターを使用しています。 – Bricktop

+2

Bricktopそれを答えとして追加してください。それを探している人が助けになります。 –

関連する問題