android+listview设置行高,android – 无法在行xml中设置listView行高的高度
這是我的自定義適配器的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方法中設置行高?
總結
以上是生活随笔為你收集整理的android+listview设置行高,android – 无法在行xml中设置listView行高的高度的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2023 款欧拉好猫 SUV 开启限时活
- 下一篇: 领克支棱起来了 全新一代智能座舱操作系统