在我的應用程序中,我正在使用「Expandable listview」。假設如果用戶選擇一個子行,我必須使該圖像視圖可見,否則不會顯示。下面的代碼使得我的imageview在用戶選擇一個子元素時可見。但是如果用戶選擇另一個子元素,那麼之前選擇的子行圖像也是可見的。不想that..If用戶選擇的孩子,孩子的ImageView的應該是visible.Also如果我選擇另一組先前選擇「子行」是不可見的...ExpandableListview自定義子行
子行
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/tvPlayerName"
android:paddingLeft="10dip"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="30dip"
android:gravity="center_vertical"/>
<ImageView
android:id="@+id/selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_centerVertical="true"
android:background="@drawable/tick_icon"/>
</RelativeLayout>
ImageView imageView=(ImageView)v.findViewById(R.id.selected);
imageView.setVisibility(View.VISIBLE);
請幫我解決這個問題..
您能否詳細說明? – Subburaj
首先在chil_row.xml中使Imageview可見性:消失/不可見。你的活動應該實現OnChildClickListener並實現上述方法。它會被調用,當用戶點擊子列表和可見的圖像 – Sri
K試過了..如何獲得該特定行(視圖)的孩子,並使該圖像可見??看到我編輯的帖子..應用程序崩潰.. – Subburaj