2013-02-05 38 views
0

我有ExpandableListViewCheckedTextView作为grouprow View。但是我需要减少组间距,所以我把它放在LinearLayout之内。该列表从此不再扩展,对点击没有任何反应。有任何想法吗?代码低于ExpandableListView - 组行不会对点击产生反应

grouprow.xml

<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="wrap_content" 
android:id="@+id/holder" 
android:clickable="true" 
android:orientation="vertical"> 
<CheckedTextView 

android:id="@+id/textView1" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_marginTop="-13dp" 
android:layout_marginBottom="-13dp" 
android:text="@string/hello_world" 
android:paddingLeft="20dp" 
android:textColor="#FFFFFF" 
android:textSize="60sp" 
android:includeFontPadding="false" 
android:textStyle="bold" /> 
</LinearLayout> 

获得组视图:

 @Override 
public View getGroupView(int groupPosition, boolean isExpanded, 
     View convertView, ViewGroup parent) { 
    if (convertView == null) { 

     convertView = minflater.inflate(R.layout.grouprow, null); 
    } 
    LinearLayout holder = (LinearLayout) convertView; 
    CheckedTextView txtGr = (CheckedTextView) holder.findViewById(R.id.textView1); 
    txtGr.setText(groupItem.get(groupPosition)); 
    txtGr.setChecked(isExpanded); 
    font = Typeface.createFromAsset(activity.getAssets(), 
      "uww.otf"); 
    txtGr.setTypeface(font); 
    return convertView; 
} 

回答

0

通过设置问题解决了的LinearLayoutCheckedTextView非点击