当前位置: 首页>>代码示例>>Java>>正文


Java ListView.addFooterView方法代码示例

本文整理汇总了Java中android.widget.ListView.addFooterView方法的典型用法代码示例。如果您正苦于以下问题:Java ListView.addFooterView方法的具体用法?Java ListView.addFooterView怎么用?Java ListView.addFooterView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ListView的用法示例。


在下文中一共展示了ListView.addFooterView方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeHeaderAndFooter

import android.widget.ListView; //导入方法依赖的package包/类
private void initializeHeaderAndFooter() {
    setListAdapter(null);
    if (hasHeaderAndFooter) {
        ListView list = getListView();

        LayoutInflater inflater = LayoutInflater.from(this);
        TextView header1 = (TextView) inflater.inflate(android.R.layout.simple_list_item_1, list, false);
        header1.setText("First header");
        list.addHeaderView(header1);

        TextView header2 = (TextView) inflater.inflate(android.R.layout.simple_list_item_1, list, false);
        header2.setText("Second header");
        list.addHeaderView(header2);

        TextView footer = (TextView) inflater.inflate(android.R.layout.simple_list_item_1, list, false);
        footer.setText("Single footer");
        list.addFooterView(footer);
    }
    initializeAdapter();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:PinnedSectionListActivity.java

示例2: initWidget

import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void initWidget(View root) {
    super.initWidget(root);
    mListView = (ListView) root.findViewById(R.id.listView);
    mRefreshLayout = (SuperRefreshLayout) root.findViewById(R.id.superRefreshLayout);
    mRefreshLayout.setColorSchemeResources(
            R.color.swiperefresh_color1, R.color.swiperefresh_color2,
            R.color.swiperefresh_color3, R.color.swiperefresh_color4);
    mErrorLayout = (EmptyLayout) root.findViewById(R.id.error_layout);
    mRefreshLayout.setSuperRefreshLayoutListener(this);
    mFooterView = LayoutInflater.from(getContext()).inflate(R.layout.layout_list_view_footer, null);
    mFooterText = (TextView) mFooterView.findViewById(R.id.tv_footer);
    mFooterProgressBar = (ProgressBar) mFooterView.findViewById(R.id.pb_footer);
    mListView.setOnItemClickListener(this);

    mErrorLayout.setOnLayoutClickListener(this);
    if (isNeedFooter())
        mListView.addFooterView(mFooterView);
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:20,代码来源:BaseListFragment.java

示例3: initListView

import android.widget.ListView; //导入方法依赖的package包/类
protected void initListView(){
    Context context = contextWeak.get();
    if(context == null) return;

    ListView alertButtonListView = (ListView) contentContainer.findViewById(R.id.alertButtonListView);

    if(cancel != null && style == Style.Alert){
        View itemView = LayoutInflater.from(context).inflate(R.layout.item_actionsheetbutton, null);
        TextView tvAlert = (TextView) itemView.findViewById(R.id.tvAlert);
        tvAlert.setText(cancel);
        tvAlert.setClickable(true);
        tvAlert.setTypeface(Typeface.DEFAULT_BOLD);
        tvAlert.setTextColor(context.getResources().getColor(R.color.textColor_alert_button_cancel));
        tvAlert.setBackgroundResource(R.drawable.bg_alertbutton_bottom);
        tvAlert.setOnClickListener(new OnTextClickListener(CANCELPOSITION));
        alertButtonListView.addFooterView(itemView);
    }
    AlertViewAdapter adapter = new AlertViewAdapter(mDatas,mDestructive);
    alertButtonListView.setAdapter(adapter);
    alertButtonListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
            if(onItemClickListener != null)onItemClickListener.onItemClick(AlertView.this,position);
            dismiss();
        }
    });
}
 
开发者ID:AppHero2,项目名称:Raffler-Android,代码行数:28,代码来源:AlertView.java

示例4: addListViewFooterView

import android.widget.ListView; //导入方法依赖的package包/类
public void addListViewFooterView(ListView listView, int flag) {
    if (mFooterView != null && mFooterStatus != flag) {
        return;
    }
    removeFooterView(listView);
    if (flag == LOADING) {
        mFooterView = mFooter.getLoadingView();
    } else if (flag == FINISH) {
        mFooterView = mFooter.getFinishView();
    } else if (flag == ERROR) {
        mFooterView = mFooter.getFailureView();
    }
    listView.addFooterView(mFooterView);
}
 
开发者ID:yanyiqun001,项目名称:goRefresh,代码行数:15,代码来源:LoadMoreHelper.java

示例5: onCreate

import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_marked_county);
    listView = (ListView) findViewById(R.id.marked_county_list);
    foot_view = LayoutInflater.from(this).inflate(R.layout.foot_view, null);
    addCounty = (Button) foot_view.findViewById(R.id.add_marked_county);

    mAdapter = new CountyListAdapter(this, R.layout.item_marked_county, mCountyList);
    listView.addFooterView(foot_view);
    listView.setAdapter(mAdapter);
    listView.setOnItemClickListener(this);
    addCounty.setOnClickListener(this);
    showMarkedCounty();
}
 
开发者ID:typer9527,项目名称:weather-mvp,代码行数:16,代码来源:MarkedCountyActivity.java

示例6: initListView

import android.widget.ListView; //导入方法依赖的package包/类
protected void initListView(){
    Context context = contextWeak.get();
    if(context == null) return;

    ListView alertButtonListView = (ListView) contentContainer.findViewById(R.id.alertButtonListView);
    //把cancel作为footerView
    if(cancel != null && style == Style.Alert){
        View itemView = LayoutInflater.from(context).inflate(R.layout.item_alertbutton, null);
        TextView tvAlert = (TextView) itemView.findViewById(R.id.tvAlert);
        tvAlert.setText(cancel);
        tvAlert.setClickable(true);
        tvAlert.setTypeface(Typeface.DEFAULT_BOLD);
        tvAlert.setTextColor(context.getResources().getColor(R.color.textColor_alert_button_cancel));
        tvAlert.setBackgroundResource(R.drawable.bg_alertbutton_bottom);
        tvAlert.setOnClickListener(new OnTextClickListener(CANCELPOSITION));
        alertButtonListView.addFooterView(itemView);
    }
    AlertViewAdapter adapter = new AlertViewAdapter(mDatas,mDestructive);
    alertButtonListView.setAdapter(adapter);
    alertButtonListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
            if(onItemClickListener != null)onItemClickListener.onItemClick(AlertView.this,position);
            dismiss();
        }
    });
}
 
开发者ID:devzwy,项目名称:NeiHanDuanZiTV,代码行数:28,代码来源:AlertView.java

示例7: onCreateView

import android.widget.ListView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    fragmentView = inflater.inflate(R.layout.fragment_activity, container,
            false);
    swipeLayout = (SwipeRefreshLayout) fragmentView
            .findViewById(R.id.swipe_container);
    swipeLayout.setColorSchemeResources(R.color.yellow, R.color.orange,
            R.color.red, R.color.purple, R.color.blue, R.color.green);
    swipeLayout.setOnRefreshListener(this);
    listView = (ListView) fragmentView.findViewById(R.id.activity_listview);
    View header = inflater.inflate(R.layout.activity_divider, listView,
            false);
    listView.addHeaderView(header);
    View footer = inflater.inflate(R.layout.activity_divider, listView,
            false);
    listView.addFooterView(footer);
    View start_button = fragmentView.findViewById(R.id.start_button);
    start_button.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View view) {
            updateActivity();
        }
    });
    return fragmentView;
}
 
开发者ID:kamisakihideyoshi,项目名称:TaipeiTechRefined,代码行数:28,代码来源:ActivityFragment.java

示例8: setSongList

import android.widget.ListView; //导入方法依赖的package包/类
public void setSongList(String json) throws JSONException{
    View requestView = viewPager.findViewById(R.id.requests_page);
    TextView searchMsg = (TextView) requestView.findViewById(R.id.searchMsg);
    ListView songListView = (ListView) requestView.findViewById(R.id.songListView);
    Integer curPage, lastPage;

    try {
        JSONObject searchObject = new JSONObject(json);
        JSONArray songs = new JSONArray(searchObject.getString("data"));
        ArrayList<Song> songList = new ArrayList<>();
        curPage = searchObject.getInt("current_page");
        lastPage = searchObject.getInt("last_page");

        for (int i = 0; i < songs.length(); i++){
            JSONObject songObject = songs.getJSONObject(i);

            if(songObject != null){
                String artist = songObject.getString("artist");
                String title = songObject.getString("title");
                Integer songID = songObject.getInt("id");
                boolean requestable = songObject.getBoolean("requestable");
                Song song = new Song(artist, title, songID, requestable);

                songList.add(song);
            }
        }

        if(songs.length() == 0) {
            searchMsg.setVisibility(View.VISIBLE);
            searchMsg.setText("No songs found for query.");
        } else {
            searchMsg.setVisibility(View.INVISIBLE);
        }

        if(searchFooter == null || songListView.getFooterViewsCount() == 0) {
            createSearchFooter(curPage, lastPage);
            songListView.addFooterView(searchFooter);
        }
        else {
            createSearchFooter(curPage, lastPage);
        }
        SongAdapter sAdapt = new SongAdapter(this, R.layout.request_cell, songList);
        songListView.setAdapter(sAdapt);
    }
    catch(JSONException ex){
        searchMsg.setVisibility(View.VISIBLE);
        searchMsg.setText("An error occurred while retrieving songs. Please try again.");
    }
}
 
开发者ID:R-a-dio,项目名称:R-a-dio-Amazing-Android-App,代码行数:50,代码来源:ActivityMain.java

示例9: showData

import android.widget.ListView; //导入方法依赖的package包/类
private void showData(List<Student> data) {

        if (mAdapter == null) {

            mListView = (ListView) findViewById(R.id.mListView);

            mFooterView = LayoutInflater.from(this).inflate(R.layout.footer_item,null);
            mFooterView.setVisibility(View.GONE);

            mListView.addFooterView(mFooterView);

            mAdapter = new ListViewAdapter(this, data);

            mListView.setAdapter(mAdapter);

        } else {

            mData = data;

            mAdapter.notifyDataSetChanged();

        }

    }
 
开发者ID:xzh1223,项目名称:ListPageDemo,代码行数:25,代码来源:LoadMoreActivity.java


注:本文中的android.widget.ListView.addFooterView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。