Hier ist meine getView Methode meines benutzerdefinierten Adapters:
public View getView(int position, View convertView, ViewGroup viewGroup) {
SingleEvent entry = listSingleEvent.get(position);
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.single_event_row, null);
}
TextView titleTextView = (TextView) convertView.findViewById(R.id.titleTextView);
titleTextView.setText(entry.getTitle());
TextView byTextView = (TextView) convertView.findViewById(R.id.byTextView);
byTextView.setText(entry.getBy());
TextView dateTextView= (TextView) convertView.findViewById(R.id.dateTextView);
dateTextView.setText(entry.getDate());
TextView descTextView= (TextView) convertView.findViewById(R.id.descTextView);
descTextView.setText(entry.getDesc());
return convertView;
}
Hier ist die Zeile xml:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:weightSum="1">
<TextView android:layout_height="wrap_content" android:id="@+id/titleTextView" android:text="TextView" android:layout_width="fill_parent"></TextView>
<TextView android:layout_height="wrap_content" android:id="@+id/byTextView" android:text="TextView" android:layout_width="fill_parent"></TextView>
<TextView android:layout_height="wrap_content" android:id="@+id/dateTextView" android:text="TextView" android:layout_width="fill_parent"></TextView>
<TextView android:id="@+id/descTextView" android:text="TextView" android:layout_width="fill_parent" android:layout_height="wrap_content"></TextView>
</LinearLayout>
Ändern der LinearLayout Höhe auf 300dp oder etwas tut nichts. Die Zeile immer noch nur umarmt die Menge des Inhalts.
Gibt es eine Möglichkeit, die Zeilenhöhe in der getView-Methode festzulegen?