Я попытался сохранить текст редактирования в групповом представлении расширяемого списка. Если я продолжаю редактировать текст Расширяется и сворачивается, не работает для группового просмотра.ExpandableListView GroupView с EditText Expanded не работает
Я пробовал с другими видами, такими как просмотр текста и флажки группового просмотра, работающие нормально.
Может быть, вы знаете, в чем причина расширения и краха, не работающего с edittext.
Образец 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>
образца после добавления EditText не 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>
Вот метод Код ExpandableListAdapter getGroupView
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;
}
Спасибо за наступление.
Что вы подразумеваете под словом «не работает для группового просмотра»? не могли бы вы объяснить. –
collpse и expand не работают для группы –
Я предполагаю, что это происходит потому, что, когда вы пытаетесь щелкнуть расширенный вид, тогда ваш текстовый вид принимает этот клик, но он должен работать, щелкнув родительский вид. –