ArrayAdapter无法显示项目会占用背景颜色。
创始人
2024-09-14 03:30:29
0

可以使用自定义布局来设置ArrayAdapter的项目视图,以避免使用背景颜色。下面是示例代码:

// 定义自定义布局layout_custom_item.xml


// 在Activity中设置ArrayAdapter的视图 ArrayAdapter adapter = new ArrayAdapter(this, R.layout.layout_custom_item, items); listView.setAdapter(adapter);

// 在getView方法中获取TextView并设置其文本 @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate(R.layout.layout_custom_item, parent, false); } TextView textView = convertView.findViewById(R.id.item_text); textView.setText(getItem(position)); return convertView; }

相关内容

热门资讯

微扑克德州专用辅助器!impo... 微扑克德州专用辅助器!impoker有挂吗,(来玩德州)原先是有挂(详细辅助必备教程);小薇(透视辅...
wepoke辅助德之星!德扑之... wepoke辅助德之星!德扑之星软件透明软件,德州ai能盈利,扑克教程(有挂方法);人气非常高,ai...
aapoker有外挂!wpk外... aapoker有外挂!wpk外挂是真的还是,(AAPOKEr)好像真的有挂(详细透视科技教程);wp...
微扑克有辅助挂!红龙扑克是不是... 微扑克有辅助挂!红龙扑克是不是有问题,(AaPOKER)好像是有挂(详细透视系统教程)微扑克有辅助挂...
aapoker透明挂!来玩德州... WePoke高级策略深度解析‌;aapoker透明挂!来玩德州扑克约局神器,(wpK)一贯真的有挂(...
aapoker有挂!wopok... aapoker有挂!wopoker手机辅助,微扑克wpk安全,软件教程(有挂技巧)是一款可以让一直输...
wepokeai代打!德州之星... wepokeai代打!德州之星辅助透视,(aapOKER)原来真的是有挂(详细透视力荐教程);超受欢...
wepoke计算辅助!wpk游... wepoke计算辅助!wpk游戏是否有挂,(wepoker)起初有挂(详细透视切实教程);实战中需综...
wpk德州透视辅助!德扑之星禁... wpk德州透视辅助!德扑之星禁止模拟器,pokermaster有挂,线上教程(有挂辅助挂);无聊就玩...
aapoker辅助!aapok... aapoker辅助!aapoker德州线上扑克辅助工具,(德州俱乐部)从来真的有挂(详细辅助规律教程...