Grup görünümüne bir düğme eklemek o kadar da zor olmamalıdır.
Aşağıdakilerin çalışması gerektiğine inanıyorum (her ne kadar bir sınama için ExpandableListView dizini kullanan bir projem yok).
Grup satır düzeninizi bilmiyorum, bu nedenle referans amacıyla burada bir tane oluşturacağım.
group_layout.xml Bağdaştırıcınızla adresinin getGroupView
yönteminde Sonra
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/test"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@android:id/text1"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center_vertical"
android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Button
android:id="@+id/addbutton"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="Add"
android:textSize="12dp" />
</LinearLayout>
: Nasıl listeyi doldururken
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
if (convertView == null) {
View convertView = View.inflate(getApplicationContext(), R.layout.group_layout, null);
Button addButton = (Button)convertView.findViewById(R.id.addButton);
addButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
// your code to add to the child list
}
});
}
TextView textView = (TextView)convertView.findViewById(R.id.text1);
textView.setText(getGroup(groupPosition).toString());
return convertView;
}
? Bir imleçten mi? Dizilerle mi? – Barak
Diziler kullanıyorum. – Swayam