2012-11-24 2 views
0

는 다음과 같은 코드가있다 :요소는 클릭 할 수 있습니다 :

  mListOfExistedMessages.setAdapter(new ExistedTasksExpandableListAdapter(context, persons)); 
      mListOfExistedMessages.setOnChildClickListener(new OnChildClickListener() { 

       @Override 
       public boolean onChildClick(ExpandableListView parent, 
         View v, int groupPosition, int childPosition, 
         long id) { 
        Toast.makeText(ExistedMessagesActivity.this, "1", 
          Toast.LENGTH_LONG).show(); 
        return false; 
       } 

      }); 
      mListOfExistedMessages.setItemsCanFocus(false); 

ExistedTasksExpandableListAdapter 내 사용자 정의 어댑터, 그리고 어댑터의 코드는 잘 작동 (그룹과 자녀에 대한 사용자 정의보기를 보여줍니다). 하위 레이아웃 코드 :

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:focusable="false" 
    android:orientation="horizontal" 
    android:padding="10dip" 
    android:paddingLeft="15dip" > 

    <CheckBox 
     android:id="@+id/listItemExistedMessageChecked" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:gravity="center" 
     android:text="" /> 

    <LinearLayout 
     android:layout_width="0dip" 
     android:layout_height="match_parent" 
     android:layout_weight="1.7" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:orientation="vertical" > 

     <TextView 
      android:id="@+id/listItemExistedMessageText" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:ellipsize="end" 
      android:focusable="false" 
      android:focusableInTouchMode="false" 
      android:maxLines="2" 
      android:text="Small Text" 
      android:textAppearance="?android:attr/textAppearanceMedium" /> 

     <TextView 
      android:id="@+id/listItemExistedMessageRepeating" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:focusable="false" 
      android:focusableInTouchMode="false" 
      android:text="Small Text" 
      android:textAppearance="?android:attr/textAppearanceSmall" 
      android:textStyle="italic" /> 
    </LinearLayout> 

    <View 
     android:layout_width="5dip" 
     android:layout_height="match_parent" 
     android:layout_marginLeft="5dip" 
     android:background="#1874CD" 
     android:focusable="false" 
     android:focusableInTouchMode="false" /> 

    <LinearLayout 
     android:layout_width="0dip" 
     android:layout_height="match_parent" 
     android:layout_weight="1" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:gravity="center" 
     android:orientation="vertical" > 

     <TextView 
      android:id="@+id/textView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:focusable="false" 
      android:focusableInTouchMode="false" 
      android:text="Next event:" 
      android:textAppearance="?android:attr/textAppearanceMedium" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/listItemExistedMessageDateTime" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:focusable="false" 
      android:focusableInTouchMode="false" 
      android:gravity="center" 
      android:text="Small Text" 
      android:textAppearance="?android:attr/textAppearanceMedium" /> 
    </LinearLayout> 

</LinearLayout> 

그러나 하위보기를 클릭하면 메시지가 표시되지 않습니다. 어떻게 해결할 수 있습니까?

답변

0

추가보십시오 : false 대신

return super.onChildClick(parent, v, groupPosition, childPosition, id); 

합니다. 이게 너를 위해 일 했니?

관련 문제