當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。