这是我的自定义适配器的getView方法:
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;
}
这是行xml:
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">
将LinearLayout高度更改为300dp或其他什么都不做.该行仍然只是拥抱内容的数量.
有没有办法在getView方法中设置行高?