I was using a simple ListView, and this simple TextView as items in that list:

<TextView
        xmlns:android="http://schemas.android.com/apk/res/android";
        android:layout_width="fill_parent"
        android:layout_height="?android:attr/listPreferredItemHeight"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:gravity="center_vertical"
        android:singleLine="true"
        android:paddingLeft="5dip"
/>

Then, I needed to change my application to use an ExpandableListView
(with a custom Adapter), so now I use this for group views:

<TextView
        xmlns:android="http://schemas.android.com/apk/res/android";
        android:layout_width="fill_parent"
        android:layout_height="?android:attr/listPreferredItemHeight"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:gravity="center_vertical"
        android:singleLine="true"
        android:paddingLeft="36dip"
        android:id="@+id/group_name"
/>

Pretty much the same thing, but the android:layout_height doesn't seem
to work, and I don't understand why. The entries are less tall than
before, barely tall enough to hold the text. Here's a bit of code that
might have something to do with my problem:

public View getGroupView(int groupPosition, boolean isExpanded,
                View convertView, ViewGroup parent) {
        if (mToDisplay == null) return null;
        String label = "Unknown";
        String group = mGroups[groupPosition];
        if (group.equals("music")) label = getString(R.string.type_music);
        else if (group.equals("movie")) label = getString(R.string.type_movie);
        else if (group.equals("book")) label = getString(R.string.type_book);
        if (convertView != null) {
                TextView text = (TextView) 
convertView.findViewById(R.id.group_name);
                if (text != null) {
                        text.setText(label);
                        return convertView;
                }
        }
        LayoutInflater inflater = getLayoutInflater();
        View view = inflater.inflate(R.layout.search_group, parent);
        TextView text = (TextView) view.findViewById(R.id.group_name);
        text.setText(label);
        return view;
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to