开发者

Customized listview

I have in my android application a listview. I have 3 images should be used as BG. 1 for the list top - with top开发者_运维百科 rounded edges 1 for the buttom list - with buttom rounded edgest 1 for middle - sharp edges.

How can I use these as BG?

Yoav


So basically, you want to have a custom layout for the first and the last item of your listview, and all the other elements will have the same layout? Right?

Maybe you should read this: http://android.amberfog.com/?p=296

Most important code is here:

if (convertView == null) {
                holder = new ViewHolder();
                switch (type) {
                    case TYPE_ITEM:
                        convertView = mInflater.inflate(R.layout.item1, null);
                        holder.textView = (TextView)convertView.findViewById(R.id.text);
                        break;
                    case TYPE_FIRST_OR_LAST_ITEM:
                        convertView = mInflater.inflate(R.layout.item2, null);
                        break;
                }
                convertView.setTag(holder);
            } else {
                holder = (ViewHolder)convertView.getTag();
            }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜