2013-11-26 31 views
0

我有一行擴展列表ExpandableListView不擴張時CheckedView變化與LinearLayout中

<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/textView1" 
    android:layout_width="wrap_content" 
    android:layout_height="60dp" 
    android:layout_marginLeft="5dp" 
    android:gravity="center_vertical" 
    android:text="@string/hello_world" 
    android:textColor="#FFFFFF" 
    android:padding="10dp" 
    android:textSelectHandleLeft="@string/hello_world" 
    android:textSize="14sp" 
    android:textStyle="bold" > 
    </CheckedTextView> 

<!--<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="40dp" 
    android:layout_gravity="center_vertical|center_horizontal" 
    android:clickable="true" 
    android:focusable="true" 
    android:gravity="center_vertical|center_horizontal" 
    android:orientation="horizontal" 
    android:paddingBottom="5dp" 
    android:paddingLeft="5dp" 
    android:paddingRight="5dp" 
    android:paddingTop="5dp" > 

<TextView 
     android:id="@+id/text_view_1" 
     style="@style/row" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:clickable="false" 
     android:focusable="false" 
     android:padding="10dp" 
     android:singleLine="false" /> 

    <TextView 
     android:id="@+id/text_view_2" 
     style="@style/row" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="3" 
     android:background="@color/expanded_row_points" 
     android:clickable="false" 
     android:focusable="false" 
     android:padding="10dp" 
     android:singleLine="false" 
     android:textColor="@color/white" /> 

</LinearLayout>--> 

,當是CheckedView是未註釋的,LinearLayout評論說它不觸發事件(不擴展)。 什麼是問題,有沒有人有線索?

回答

1

很難按照你的問題,但如果你正在使用的LinearLayout作爲小區佈局如下:

android:clickable="true" 
android:focusable="true" 

大概覆蓋了默認點擊操作。由於單元佈局消耗了點擊,所以listview從不知道要展開。