Android adding footer to ListView addFooterView()?

后端 未结 3 1410
时光取名叫无心
时光取名叫无心 2020-12-10 04:08

I have a ListView activity that needs a footer to the list of items so that you can click it and it would load more items into the list. The list is backed my an SimpleAdapt

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-10 04:36

    View footerView = getLayoutInflater().inflate(R.layout.search_footer,
                mContentList, false);
        LongButton mSearchMoreBtn = (LongButton) footerView
                .findViewById(R.id.searchmore_btn);
        mSearchMoreBtn.setText(R.string.search_moreapp);//the button to add 
        mSearchMoreBtn.setBackgroundResource(R.drawable.btn_long_selector);
        mSearchMoreBtn.setOnClickListener(mSearchMoreBtnListener);
    
        footerView.setOnClickListener(mLoadMoreAppsListener);
        mContentList.addFooterView(footerView);  
    

    I have no idea that when I adding mSearchMoreBtn to ListView as footerView, it is wrong, instead, when I adding footerView to ListView, it just fine

提交回复
热议问题