码迷,mamicode.com
首页 > 其他好文 > 详细

发布文章居然不在首页

时间:2015-08-01 00:51:08      阅读:98      评论:0      收藏:0      [点我收藏+]

标签:

测试代码着色

package com.example.news;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class Newsadapter extends ArrayAdapter<News> {

    private int resourceId;

    /**
     * 构造没有看懂
     * 
     * @param context
     * @param textViewResourceId
     * @param objects
     */
    public Newsadapter(Context context, int textViewResourceId,
            List<News> objects) {
        super(context, textViewResourceId, objects);
        resourceId = textViewResourceId;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        /**
         * ???? 参数为 编号,子布局,父布局
         */
        News news = getItem(position);
        View view;
        if (convertView == null) {
            view = LayoutInflater.from(getContext()).inflate(resourceId, null);
        } else {
            view = convertView;
        }
        TextView newsTitleText = (TextView) view.findViewById(R.id.news_title);
        newsTitleText.setText(news.getTitle());
        return view;

    }

}

 

发布文章居然不在首页

标签:

原文地址:http://www.cnblogs.com/xihefeng/p/4693465.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!