J'ai un ExpandalbeList simple. Pour la vue d'en-tête de groupe, j'utilise un simple TextView, je mets l'arrière-plan du texte à un dessinable. J'ai les paramètres textview définis sur FILL_PARENT, mais l'arrière-plan de TextView ne couvre que la largeur du texte. Je me rends compte que je peux tout mettre à l'intérieur d'une disposition linéaire, mais cela semble juste une perte. n'existe-t-il pas un moyen de faire en sorte que les limites de la vue de texte s'étendent jusqu'au bord de la liste?android textview fill parent
public TextView getGenericView() {
// Layout parameters for the ExpandableListView
AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT, 64);
TextView textView = new TextView(PulseSearchResults.this);
textView.setLayoutParams(lp);
// Center the text vertically
textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
// Set the text starting position
textView.setPadding(6, 0, 0, 0);
textView.setTextColor(Color.BLACK);
textView.setTypeface(Typeface.DEFAULT_BOLD);
textView.setTextSize(16.0f);
textView.setBackgroundResource(R.drawable.search_section_group);
return textView;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
TextView textView = getGenericView();
textView.setText(getGroup(groupPosition).toString());
return textView;
}
thx Ben