Java Code Examples for android.widget.ExpandableListView.addHeaderView()

The following are Jave code examples for showing how to use addHeaderView() of the android.widget.ExpandableListView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ywApplication   File: SearchFragment.java   Source Code and License Vote up 6 votes
private void initView(View view) {
    expandableListView = (ExpandableListView) view.findViewById(R.id.search_listview);
    heardView = inflater.inflate(R.layout.search_item_heard_view, expandableListView, false);
    setclickListener(heardView);
    contantsAdapter = new ContantsAdapter(getActivity(), groupImgId, text, datas,numId);
    expandableListView.setAdapter(contantsAdapter);
    expandableListView.addHeaderView(heardView);
    expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
        @Override
        public void onGroupExpand(int groupPosition) {
            for (int i = 0; i <groupImgId.size() ; i++) {
                if (groupPosition !=i) {
                    expandableListView.collapseGroup(i);
                }
            }
        }
    });
}
 
Example 2
Project: letv   File: PullToRefreshExpandableListView.java   Source Code and License Vote up 5 votes
protected final ExpandableListView createRefreshableView(Context context, AttributeSet attrs) {
    ExpandableListView lv;
    if (VERSION.SDK_INT >= 9) {
        lv = new InternalExpandableListViewSDK9(this, context, attrs);
    } else {
        lv = new InternalExpandableListView(this, context, attrs);
    }
    lv.setLayoutParams(new LayoutParams(-1, -1));
    int mode = getMode();
    String pullLabel = context.getString(2131100695);
    String refreshingLabel = context.getString(2131100699);
    String releaseLabel = context.getString(2131100700);
    if (mode == 1 || mode == 3) {
        this.mLvHeaderLoadingFrame = new FrameLayout(context);
        this.mHeaderLoadingView = new PullToRefreshHeaderView(context, 1, releaseLabel, pullLabel, refreshingLabel, new Object[0]);
        this.mLvHeaderLoadingFrame.addView(this.mHeaderLoadingView, -1, (int) ((60.0f * getResources().getDisplayMetrics().density) + 0.5f));
        this.mHeaderLoadingView.setVisibility(8);
        lv.addHeaderView(this.mLvHeaderLoadingFrame, null, false);
    }
    if (mode == 2 || mode == 3) {
        this.mLvFooterLoadingFrame = new FrameLayout(context);
        this.mFooterLoadingView = new PullToRefreshHeaderView(context, 2, releaseLabel, pullLabel, refreshingLabel, new Object[0]);
        this.mLvFooterLoadingFrame.addView(this.mFooterLoadingView, -1, -2);
        this.mFooterLoadingView.setVisibility(8);
    }
    lv.setId(16908293);
    return lv;
}