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


Java ListView.addHeaderView方法代码示例

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


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

示例1: doShortcut

import android.widget.ListView; //导入方法依赖的package包/类
public void doShortcut() {

        setContentView(R.layout.activity_setup_widget);
        setupAppBar(R.id.toolbar, R.string.widget_creation_title, true, true);
        header = getLayoutInflater().inflate(R.layout.widget_header, null);

        ListView list = (ListView) findViewById(R.id.subs);
        final ArrayList<FeedWrapper> sorted = new ArrayList<FeedWrapper>(Realm.getDefaultInstance().where(Feed.class).findAllSorted("order"));
        sorted.addAll(Realm.getDefaultInstance().where(Category.class).findAllSorted("order"));
        Collections.sort(sorted, new Comparator<FeedWrapper>() {
            @Override
            public int compare(FeedWrapper p1, FeedWrapper p2) {
                return p1.getOrder() - p2.getOrder();// Ascending
            }

        });
        final SideArrayAdapter adapter = new SideArrayAdapter(this, sorted, list);

        list.addHeaderView(header);
        list.setAdapter(adapter);
    }
 
开发者ID:ccrama,项目名称:Slide-RSS,代码行数:22,代码来源:SetupWidget.java

示例2: 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

示例3: onCreateView

import android.widget.ListView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_settings, container, false);

    // Inflate chess.com logo
    View header = inflater.inflate(R.layout.list_settings_header, null);
    header.setOnClickListener(mHeaderClickListener);

    // Init ListView
    mListView = (ListView) v.findViewById(R.id.list_time_controls);
    mListView.addHeaderView(header, null, false);
    mListView.setOnItemClickListener(mItemClickListener);

    // Set start button listener
    mStartBtn = v.findViewById(R.id.btn_start);
    mStartBtn.setOnClickListener(mStartBtnListener);

    // Set List Adapter and selection positions.
    setupListView(savedInstanceState);

    return v;
}
 
开发者ID:ChessCom,项目名称:android-chessclock,代码行数:23,代码来源:SettingsFragment.java

示例4: viewInitialize

import android.widget.ListView; //导入方法依赖的package包/类
public void viewInitialize()
{
    mainListView = (ListView) v.findViewById(R.id.listview);
    swiperefresh = (SwipeRefreshLayout) v.findViewById(R.id.swiperefresh);
    swiperefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
    {
        @Override
        public void onRefresh()
        {
            prepare();
        }
    });

    cardHeader = new CardHeader(getContext());
    cardHeader.setTitleIcon(getResources().getDrawable(R.drawable.ic_thumb_up));
    cardHeader.setTitleText("가장 많이 들은 곡 20곡");
    mainListView.addHeaderView(cardHeader);
}
 
开发者ID:icaynia,项目名称:pracler,代码行数:19,代码来源:MyTop20Fragment.java

示例5: initWidgets

import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void initWidgets() {
    super.initWidgets();
    mLayoutBottom = (RelativeLayout) findViewById(R.id.kf5_bottom_layout);
    mFeedBackDetailBottomView = new FeedBackDetailBottomView(mActivity);
    mFeedBackDetailBottomView.setListener(this);
    mETContent = layoutListener.getEditText();
    mLayoutBottom.addView(mFeedBackDetailBottomView);
    mListView = (ListView) findViewById(R.id.kf5_activity_feed_back_details_listview);
    mListView.setOnScrollListener(this);
    mListView.setOnItemLongClickListener(this);
    mListView.addHeaderView(inflateHeaderView());
    mBackImg = (ImageView) findViewById(R.id.kf5_return_img);
    mBackImg.setOnClickListener(this);
    mRightView = (TextView) findViewById(R.id.kf5_right_text_view);
    mRightView.setOnClickListener(this);
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:18,代码来源:FeedBackDetailsActivity.java

示例6: onCreate

import android.widget.ListView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.i("info", "fragmentwefef");
    setContentView(R.layout.activity_info1_listview);
    topView= (LinearLayout) getLayoutInflater()
            .inflate(R.layout.activity_info1_headview, null);
    handler=new Handler();
    listView= (ListView) findViewById(R.id.info1_listView);
    listView.addHeaderView(topView);
    apps=new ArrayList<Data.App_Share_List>();
    bitmapUtils=new BitmapUtils(this);
    adapter=new Info1_ListViewAdapter(apps,this,bitmapUtils);
    listView.setAdapter(adapter);
    memberShareTagId=getIntent().getIntExtra("memberShareTagId", 0);
    path=String.format(method,memberShareTagId);
    httpUtils=new HttpUtils();

    //initHeadView(topView,mem);
    loadData();
}
 
开发者ID:liupengandroid,项目名称:ywApplication,代码行数:22,代码来源:Info1Activity.java

示例7: onCreate

import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_listview);

    mAutoScrollPagerAdapter = new BannerAdapter(this, 3, true);
    mListView = (ListView) findViewById(R.id.listview);
    mSwipeRefreshLayout = (CustomSwipeRefreshLayout) findViewById(R.id.swiperefresh_layout);
    // AutoScrollViewPager header
    View headerView = LayoutInflater.from(this).inflate(R.layout.list_header, mListView, false);
    mAutoScrollViewPager = (CycleViewPager) headerView.findViewById(R.id.banner);
    mIndicator = (ViewPagerIndicator) headerView.findViewById(R.id.viewpager_indicator);
    mListView.addHeaderView(headerView);
    // mAutoScrollViewPager.setPageSwitchDuration(800);
    // mAutoScrollViewPager.setAutoScrollInterval(4000);
    mListView.setAdapter(new ArrayAdapter<String>(WorkInListViewActivity.this, android.R.layout.simple_list_item_1, android.R.id.text1, getData()));
    mAutoScrollViewPager.setAdapter(mAutoScrollPagerAdapter);
    mIndicator.bindToViewPager(mAutoScrollViewPager);
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            WorkInListViewActivity.this.onRefresh();
        }
    });
}
 
开发者ID:leandom,项目名称:CycleViewPager,代码行数:26,代码来源:WorkInListViewActivity.java

示例8: setupViews

import android.widget.ListView; //导入方法依赖的package包/类
@Override
void setupViews(ViewGroup view) {
    if (showSearchBox) {
        ListView listView = (ListView) view.findViewById(R.id.com_facebook_picker_list_view);

        View searchHeaderView = getActivity().getLayoutInflater().inflate(
                R.layout.com_facebook_picker_search_box, listView, false);

        listView.addHeaderView(searchHeaderView, null, false);

        searchBox = (EditText) view.findViewById(R.id.com_facebook_picker_search_text);

        searchBox.addTextChangedListener(new SearchTextWatcher());
        if (!TextUtils.isEmpty(searchText)) {
            searchBox.setText(searchText);
        }
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:19,代码来源:PlacePickerFragment.java

示例9: initView

import android.widget.ListView; //导入方法依赖的package包/类
private void initView() {
    // 获取listview对象
    lv_grouplist = (ListView)findViewById(R.id.lv_grouplist);

    // 添加头布局
    View headerView = View.inflate(this, R.layout.header_grouplist, null);
    lv_grouplist.addHeaderView(headerView);

    ll_grouplist = (LinearLayout) headerView.findViewById(R.id.ll_grouplist);
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:11,代码来源:GroupListActivity.java

示例10: onActivityCreated

import android.widget.ListView; //导入方法依赖的package包/类
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    lAdapter = new LabelAdapter(getActivity(), null, 0);
    setListAdapter(lAdapter);
    getActivity().getSupportLoaderManager().initLoader(LOADER_ID, null, this);
    myActivity = (MainActivity) getActivity();
    myActivity.getSupportActionBar().setTitle("Labels");
    myActivity.hideSoftKeyboard(true);
    myActivity.fabVisibility(false);

    ListView listView = getListView();

    if(selecting){
        setActivateOnItemClick(true);
        myActivity.getSupportActionBar().setTitle("Select label");
        // Add "no label" to list
        View noLabel =  View.inflate(getContext(), R.layout.fragment_label_item, null);
        TextView labelTag = noLabel.findViewById(R.id.label_tag);
        labelTag.setText(R.string.none);
        listView.addHeaderView(noLabel);
    } else {
        listView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE_MODAL);
        listView.setMultiChoiceModeListener(myMultiChoiceModeListener);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                ToduleLabelAddFragment f = ToduleLabelAddFragment.newInstance(l);
                myActivity.getSupportFragmentManager().beginTransaction()
                        .setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right)
                        .replace(R.id.fragment_container, f)
                        .addToBackStack(null)
                        .commit();
            }
        });
    }
}
 
开发者ID:danlls,项目名称:Todule-android,代码行数:38,代码来源:ToduleLabelFragment.java

示例11: setListHeader

import android.widget.ListView; //导入方法依赖的package包/类
private void setListHeader(ListView listView) {
    ViewGroup header = (ViewGroup) getLayoutInflater().inflate(
            R.layout.view_task_create, listView, false);

    final ImageView imageView = (ImageView) header.findViewById(R.id.image);
    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            displayAttachImageDialog(null);
        }
    });

    final EditText text = (EditText) header.findViewById(R.id.text);
    text.setOnKeyListener(new View.OnKeyListener() {
        @Override
        public boolean onKey(View view, int i, KeyEvent keyEvent) {
            if ((keyEvent.getAction() == KeyEvent.ACTION_DOWN) &&
                    (keyEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
                String inputText = text.getText().toString();
                if (inputText.length() > 0)
                    createTask(inputText, mImageToBeAttached, mListId);

                text.setText("");
                deleteCurrentPhoto();

                return true;
            }
            return false;
        }
    });

    listView.addHeaderView(header);
}
 
开发者ID:Kaufland,项目名称:andcouchbaseentity,代码行数:34,代码来源:TaskActivity.java

示例12: onCreate

import android.widget.ListView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    setContentView(R.layout.barrage_list);
    ListView listView = getListView();
    LayoutInflater inflater = LayoutInflater.from(this);
    BarrageHeaderView headerView = (BarrageHeaderView)inflater.inflate(R.layout.barrage_header_view, listView, false);
    headerView.bind(getString(R.string.menu_new_barrage), getString(R.string.create_new_barrage));
    listView.addHeaderView(headerView, null, true);
    
    //UI Preview
    /*BarrageHeaderView item1 = (BarrageHeaderView)inflater.inflate(R.layout.barrage_header_view, listView, false);
    item1.bind(this, new BarrageHeader("Testing 1, 2, 3...", BarrageHeader.STATUS_RUNNING, 43, 12));
    listView.addHeaderView(item1, null, true);
    BarrageHeaderView item4 = (BarrageHeaderView)inflater.inflate(R.layout.barrage_header_view, listView, false);
    item4.bind(this, new BarrageHeader("Another Barrage", BarrageHeader.STATUS_PAUSED, 123, 64));
    listView.addHeaderView(item4, null, true);
    BarrageHeaderView item2 = (BarrageHeaderView)inflater.inflate(R.layout.barrage_header_view, listView, false);
    item2.bind(this, new BarrageHeader("Pie Day", BarrageHeader.STATUS_QUEUED, 43, 12));
    listView.addHeaderView(item2, null, true);
    BarrageHeaderView item3 = (BarrageHeaderView)inflater.inflate(R.layout.barrage_header_view, listView, false);
    item3.bind(this, new BarrageHeader("Some Name", BarrageHeader.STATUS_DRAFT, 160, 12));
    listView.addHeaderView(item3, null, true);*/
    
    setListAdapter(new BarrageListAdapter(this, null, true));
    
    if (savedInstanceState != null) {
    	//do something
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:32,代码来源:BarrageList.java

示例13: initView

import android.widget.ListView; //导入方法依赖的package包/类
private void initView(View view) {
    mSearchEditText = (EditText) view.findViewById(R.id.search);
    mListView = (ListView) view.findViewById(R.id.listview);
    mNoFriends = (TextView) view.findViewById(R.id.show_no_friend);
    mSidBar = (SideBar) view.findViewById(R.id.sidrbar);
    mDialogTextView = (TextView) view.findViewById(R.id.group_dialog);
    mSidBar.setTextView(mDialogTextView);
    LayoutInflater mLayoutInflater = LayoutInflater.from(getActivity());
    mHeadView = mLayoutInflater.inflate(R.layout.item_contact_list_header,
                                        null);
    mUnreadTextView = (TextView) mHeadView.findViewById(R.id.tv_unread);
    RelativeLayout newFriendsLayout = (RelativeLayout) mHeadView.findViewById(R.id.re_newfriends);
    RelativeLayout groupLayout = (RelativeLayout) mHeadView.findViewById(R.id.re_chatroom);
    RelativeLayout publicServiceLayout = (RelativeLayout) mHeadView.findViewById(R.id.publicservice);
    RelativeLayout selfLayout = (RelativeLayout) mHeadView.findViewById(R.id.contact_me_item);
    mSelectableRoundedImageView = (SelectableRoundedImageView) mHeadView.findViewById(R.id.contact_me_img);
    mNameTextView = (TextView) mHeadView.findViewById(R.id.contact_me_name);
    updatePersonalUI();
    mListView.addHeaderView(mHeadView);
    mNoFriends.setVisibility(View.VISIBLE);

    selfLayout.setOnClickListener(this);
    groupLayout.setOnClickListener(this);
    newFriendsLayout.setOnClickListener(this);
    publicServiceLayout.setOnClickListener(this);
    //设置右侧触摸监听
    mSidBar.setOnTouchingLetterChangedListener(new SideBar.OnTouchingLetterChangedListener() {

        @Override
        public void onTouchingLetterChanged(String s) {
            //该字母首次出现的位置
            int position = mFriendListAdapter.getPositionForSection(s.charAt(0));
            if (position != -1) {
                mListView.setSelection(position);
            }

        }
    });
}
 
开发者ID:zqHero,项目名称:rongyunDemo,代码行数:40,代码来源:ContactsFragment.java

示例14: onActivityCreated

import android.widget.ListView; //导入方法依赖的package包/类
@Override 
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    ListView lv = getListView();

    //getListView().setSelector(R.drawable.transparent);
    lv.setCacheColorHint(Color.TRANSPARENT);
    
    
    // View management
    View detailsFrame = getActivity().findViewById(R.id.details);
    dualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE;
    

    if (savedInstanceState != null) {
        // Restore last state for checked position.
        curCheckFilterId = savedInstanceState.getLong(CURRENT_CHOICE, SipProfile.INVALID_ID);
        //curCheckWizard = savedInstanceState.getString(CURRENT_WIZARD);
    }
    setListShown(false);
    if(mAdapter == null) {
        if(mHeaderView != null) {
            lv.addHeaderView(mHeaderView , null, true);
        }
        mAdapter = new AccountFiltersListAdapter(getActivity(), null);
        //getListView().setEmptyView(getActivity().findViewById(R.id.progress_container));
        //getActivity().findViewById(android.R.id.empty).setVisibility(View.GONE);
        setListAdapter(mAdapter);
        registerForContextMenu(lv);

        
        lv.setVerticalFadingEdgeEnabled(true);
    }
    
    if (dualPane) {
        // In dual-pane mode, the list view highlights the selected item.
    	Log.d("lp", "dual pane mode");
        lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    	//lv.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT);
        lv.setVerticalScrollBarEnabled(false);
        lv.setFadingEdgeLength(50);
        
        updateCheckedItem();
        // Make sure our UI is in the correct state.
        //showDetails(curCheckPosition, curCheckWizard);
    }else {
    	//getListView().setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT);
    	lv.setVerticalScrollBarEnabled(true);
    	lv.setFadingEdgeLength(100);
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:52,代码来源:AccountFiltersListFragment.java

示例15: buildViews

import android.widget.ListView; //导入方法依赖的package包/类
private View buildViews() {
    View wrapperView = View.inflate(mContext, getContentViewLayoutId(), null);
    mTitleTv = (TextView) wrapperView.findViewById(R.id.title);
    mContainerView = (ListView) wrapperView.findViewById(R.id.listview);
    if (mTitle != null && mTitle.length() != 0) {
        mTitleTv.setVisibility(View.VISIBLE);
        mTitleTv.setText(mTitle);
    } else {
        mTitleTv.setVisibility(View.GONE);
    }
    if (mHeaderViews.size() > 0) {
        for (View headerView : mHeaderViews) {
            mContainerView.addHeaderView(headerView);
        }
    }
    if (needToScroll()) {
        mContainerView.getLayoutParams().height = getListMaxHeight();
        mDialog.setOnBottomSheetShowListener(new OnBottomSheetShowListener() {
            @Override
            public void onShow() {
                mContainerView.setSelection(mCheckedIndex);
            }
        });
    }

    mAdapter = new ListAdapter();
    mContainerView.setAdapter(mAdapter);
    return wrapperView;
}
 
开发者ID:coopese,项目名称:qmui,代码行数:30,代码来源:QMUIBottomSheet.java


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