2016-05-05 2 views
0

Ich habe versucht, bearbeiten Text in der Gruppenansicht der erweiterbaren Listview.Wenn ich Text bearbeiten Expanded und minimiert nicht für die Groupview arbeiten.ExpandableListView GroupView mit einem EditText Expanded funktioniert nicht

Ich versuchte mit anderen Ansichten wie Textansicht und Kontrollkästchen Gruppenansicht funktioniert gut.

Können Sie wissen, was der Grund für Expand und Collapse nicht mit Editiertext funktioniert.

Probe wroking groupview.xml

<?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:background="#8cae88" 
    android:orientation="horizontal" 
    android:padding="8dp" > 

    <TextView 
     android:id="@+id/lblListHeader" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:paddingBottom="5dp" 
     android:paddingLeft="?android:attr/expandableListPreferredChildPaddingLeft" 
     android:paddingTop="5dp" 
     android:textColor="#f9f93d" 
     android:textSize="17dp" /> 


    <TextView 
     android:id="@+id/textOne" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:paddingBottom="5dp" 
     android:paddingTop="5dp" 
     android:text="SampleTxt" 
     android:textColor="#f9f93d" 
     android:textSize="17dp" /> 



</LinearLayout> 

Probe nach EditText nicht wroking groupview.xml

<?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:background="#8cae88" 
    android:orientation="horizontal" 
    android:padding="8dp" > 

    <TextView 
     android:id="@+id/lblListHeader" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:paddingBottom="5dp" 
     android:paddingLeft="?android:attr/expandableListPreferredChildPaddingLeft" 
     android:paddingTop="5dp" 
     android:textColor="#f9f93d" 
     android:textSize="17dp" /> 


    <TextView 
     android:id="@+id/textOne" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:paddingBottom="5dp" 
     android:paddingTop="5dp" 
     android:text="SampleTxt" 
     android:textColor="#f9f93d" 
     android:textSize="17dp" /> 
<EditText 
     android:id="@+id/b_discount" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:paddingBottom="5dp" 
     android:paddingTop="5dp" /> 


</LinearLayout> 

Hier ist die ExpandableListAdapter getGroupView Methodencode

public View getGroupView(int groupPosition, boolean isExpanded, 
       View convertView, ViewGroup parent) { 
      String headerTitle = (String) getGroup(groupPosition); 
      if (convertView == null) { 
       LayoutInflater infalInflater = (LayoutInflater) this._context 
         .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
       convertView = infalInflater.inflate(R.layout.list_group, null); 
      } 

      TextView lblListHeader = (TextView) convertView 
        .findViewById(R.id.lblListHeader); 
      lblListHeader.setTypeface(null, Typeface.BOLD); 
      lblListHeader.setText(headerTitle);convertView.setBackgroundResource(R.color.blue_list_dashboard); 
      return convertView; 
     } 
Hinzufügen

Danke für den Fortschritt.

+0

Was meinen Sie mit "nicht für die Gruppenansicht arbeiten"? Können Sie bitte erklären .. –

+0

kollabieren und erweitern nicht funktioniert für die Gruppe –

+0

Ich denke, das ist, weil, wenn Sie versuchen, auf die erweiterte Ansicht klicken, dann Ihre Textansicht nimmt das Klicken, aber es sollte funktionieren, indem Sie auf die übergeordnete Ansicht klicken. –

Antwort

0

Ich war mit dem gleichen Problem konfrontiert. Konnte die Lösung nicht finden. Versuchte alle Dinge. Aber was ich tat, ist: -

<Linearlayout> 
    <edittext> (Gone) 
</Linearlayout> 

Wenn Benutzer klicken Sie auf EditText nur sichtbar EditText und setzen Fokus auf EditText. Nur eine Art Trick.

Wenn jemand die beste Lösung haben, bitte kommen Sie. Weil es kein guter Weg ist. Aber es funktioniert.

Verwandte Themen