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


Java ExpandableListView.setAdapter方法代码示例

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


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

示例1: RecentTabsPage

import android.widget.ExpandableListView; //导入方法依赖的package包/类
/**
 * Constructor returns an instance of RecentTabsPage.
 *
 * @param activity The activity this view belongs to.
 * @param recentTabsManager The RecentTabsManager which provides the model data.
 */
public RecentTabsPage(Activity activity, RecentTabsManager recentTabsManager) {
    mActivity = activity;
    mRecentTabsManager = recentTabsManager;

    mTitle = activity.getResources().getString(R.string.recent_tabs);
    mThemeColor = ApiCompatibilityUtils.getColor(
            activity.getResources(), R.color.default_primary_color);
    mRecentTabsManager.setUpdatedCallback(this);
    LayoutInflater inflater = LayoutInflater.from(activity);
    mView = (ViewGroup) inflater.inflate(R.layout.recent_tabs_page, null);
    mListView = (ExpandableListView) mView.findViewById(R.id.odp_listview);
    mAdapter = buildAdapter(activity, recentTabsManager);
    mListView.setAdapter(mAdapter);
    mListView.setOnChildClickListener(this);
    mListView.setGroupIndicator(null);
    mListView.setOnGroupCollapseListener(this);
    mListView.setOnGroupExpandListener(this);
    mListView.setOnCreateContextMenuListener(this);

    mView.addOnAttachStateChangeListener(this);
    ApplicationStatus.registerStateListenerForActivity(this, activity);
    // {@link #mInForeground} will be updated once the view is attached to the window.

    onUpdated();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:32,代码来源:RecentTabsPage.java

示例2: onActivityCreated

import android.widget.ExpandableListView; //导入方法依赖的package包/类
@Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated (savedInstanceState);
        ImageButton btnAddNotes = (ImageButton) getActivity ().findViewById (R.id.buttonAddNotesTags);
        btnAddNotes.setOnClickListener (this);
        btnAddNotes.setVisibility (View.INVISIBLE);
//        ListView mListViewTag = (ListView) getActivity().findViewById(R.id.listNotesAll);

        mExpandableListViewTag = (ExpandableListView) getActivity ().findViewById (R.id.expandableListNotesTags);

        mArrayListTagNotes = new ArrayList<> ();
//        customAdapterTagNotes = new CustomAdapter(mArrayListTagNotes, getActivity(),tempString , mHandler);
        mCustomAdapterTags = new CustomAdapterTags (getActivity (), Integer.parseInt (mSectionIndex) + 1);
        mExpandableListViewTag.setTag (R.string.filename, mSectionIndex);
        mExpandableListViewTag.setTag (R.string.list_object, mArrayListTagNotes);
        mExpandableListViewTag.setAdapter (mCustomAdapterTags);
        mExpandableListViewTag.setItemsCanFocus (true);
        registerForContextMenu (mExpandableListViewTag);
        mSectionIndex = String.valueOf (mOnFragmentInteractionListener.getSectionIndex());
        populateListView ();

    }
 
开发者ID:atulgpt,项目名称:TimeTrix,代码行数:23,代码来源:FragmentTagNotes.java

示例3: initView

import android.widget.ExpandableListView; //导入方法依赖的package包/类
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);
                }
            }
        }
    });
}
 
开发者ID:liupengandroid,项目名称:ywApplication,代码行数:19,代码来源:SearchFragment.java

示例4: initViews

import android.widget.ExpandableListView; //导入方法依赖的package包/类
private void initViews() {
	mNavigationIndex = getIntent()
			.getIntExtra(EXTRA_PRE_LOAD_DATA_INDEX, 0);
	llytOperate = (LinearLayout) findViewById(R.id.operate);
	btnCancel = (Button) findViewById(R.id.cancel);
	btnCancel.setOnClickListener(this);
	btnPay = (Button) findViewById(R.id.pay);
	btnPay.setOnClickListener(this);
	tvEmptyView = (TextView) findViewById(R.id.emptyView);
	lvOrders = (ExpandableListView) findViewById(R.id.orders);

	lvOrders.setEmptyView(tvEmptyView);
	LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
	View footerView = inflater.inflate(R.layout.fv_a6_order, null);
	lvOrders.addFooterView(footerView);
	mAdapter = new A6OrderExpandableAdapter(this, mLstODBInfos);
	lvOrders.setAdapter(mAdapter);

	// btnPay.setEnabled(false);
	setPanelGone(true);
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:22,代码来源:A6OrderAty.java

示例5: onCreateView

import android.widget.ExpandableListView; //导入方法依赖的package包/类
/**
 * Instantiate our data sources with firebase and our list adapters / view bindings
 * @param inflater
 * @param container
 * @param savedInstanceState
 * @return
 */
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_following_habits, container, false);

    ExpandableListView followingHabitsView =
            (ExpandableListView) view.findViewById(R.id.following_habits_list);

    String userId = CurrentUser.getInstance().getUserId();

    followingDataSource = new SocialDataSource(userId, SocialDataSource.UserType.FOLLOWING);
    followingDataSource.addObserver(this);
    following = followingDataSource.getSource();

    followingHabitsAdapter = new FollowingHabitsListAdapter(
            getActivity(),
            following,
            followingHabitMap
            );

    followingHabitsView.setAdapter(followingHabitsAdapter);

    return view;
}
 
开发者ID:CMPUT301F17T13,项目名称:cat-is-a-dog,代码行数:32,代码来源:FollowingHabitsFragment.java

示例6: onCreateView

import android.widget.ExpandableListView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    prefs = getContext().getSharedPreferences(STUDENT_PREFS, 0);

    View view =  inflater.inflate(R.layout.fragment_profile, container, false);

    fillInData(view);

    // get the listview
    expListView = (ExpandableListView) view.findViewById(R.id.lvExp);

    prepareListData();
    listAdapter = new ExpandableListAdapter(view.getContext(), listDataHeader, listDataChild);

    // setting list adapter
    expListView.setAdapter(listAdapter);

    return view;
}
 
开发者ID:umdcs,项目名称:linkedout_procon,代码行数:22,代码来源:Profile.java

示例7: onCreate

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

    listView = (ExpandableListView) findViewById(R.id.expandableListView);
    listView.setGroupIndicator(null);
    /**
     * 初始化数据
     */
    initData();
    adapter = new ExAdapter(this, lines);
    listView.setAdapter(adapter);
    //遍历所有group,将所有项设置成默认展开
    int groupCount = listView.getCount();
    for (int i = 0; i < groupCount; i++) {
        listView.expandGroup(i);
    }
}
 
开发者ID:Glorylan,项目名称:expandableListviewDemo,代码行数:20,代码来源:MainActivity.java

示例8: onCreateView

import android.widget.ExpandableListView; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.category_list, container, false);
    expandableListView = (ExpandableListView) rootView.findViewById(R.id.expandable_category_list);
    addOnClickListeners();
    listAdapter = new ExpandableCategoryAdapter(
            getActivity(),
            HomeActivity.xhb.getTopCategoriesForMonthlyBudget(HomeActivity.CURRENT_MONTH),
            HomeActivity.CURRENT_MONTH
    );
    expandableListView.setAdapter(listAdapter);
    return rootView;
}
 
开发者ID:monsieurh,项目名称:homebank_android,代码行数:15,代码来源:BudgetSummaryFragment.java

示例9: showDetailsInfo

import android.widget.ExpandableListView; //导入方法依赖的package包/类
/**
 * Shows the popup that is opened when the user clicks on the info action button of a details page.
 * An {@link ExpandableListView} is used as a layout.
 *
 * @param context The context to show the popup in.
 * @param title The popup's title.
 * @param groups The expandable categories.
 * @param entries Each category in <code>groups</code> shows one entry when expanded.
 * @return The dialog.
 */
private static AlertDialog showDetailsInfo(Context context, String title,
                                           String[] groups, String[] entries,
                                           DialogInterface.OnClickListener onSubmitListener) {
    if (groups.length != entries.length) {
        throw new IllegalArgumentException();
    }

    // Custom title
    TextView customTitle = (TextView) LayoutInflater.from(context).inflate(R.layout.popup_title, null);
    customTitle.setText(title);

    View popupDetailsInfo = LayoutInflater.from(context)
            .inflate(R.layout.popup_details_info, null);
    ExpandableListView listViewDetailsInfo = (ExpandableListView)
            popupDetailsInfo.findViewById(R.id.expandablelistview_popup_details_info);
    ExpandableListAdapter adapter = createDetailsInfoAdapter(context, groups, entries);
    listViewDetailsInfo.setAdapter(adapter);

    AlertDialog.Builder popupBuilder = new AlertDialog.Builder(context);
    popupBuilder.setView(popupDetailsInfo)
            .setNeutralButton(R.string.ok, onSubmitListener)
            .setCustomTitle(customTitle);

    AlertDialog dialog = popupBuilder.create();
    dialog.show();

    Utility.setFont(FontManager.Font.ROBOTO_LIGHT, new TextView[]{
            customTitle
    });

    return dialog;
}
 
开发者ID:mr-kojo,项目名称:Veggietizer,代码行数:43,代码来源:Popup.java

示例10: onViewCreated

import android.widget.ExpandableListView; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    user = (Profile) getArguments().getSerializable(ID_PROFILE);
    noHabits = (TextView) view.findViewById(R.id.noHabits);
    if (user.hasValidId())
        user.load();

    if (user.getHabits().size() > 0) {
        noHabits.setVisibility(View.GONE);
    }

    user.synchronize();

    // handle any habits that may have been missed since the user's last login
    Date currentDate = new Date();
    if (user.getLastLogin() != null && !DateUtilities.isSameDay(user.getLastLogin(), currentDate)) {
        GregorianCalendar calendar = new GregorianCalendar();
        calendar.setTime(user.getLastLogin());

        // go through each date between the user's last login and the current date
        while (!DateUtilities.isSameDay(calendar.getTime(), currentDate)){
            // update all events at the end of that date, to make sure they are marked as missed if they weren't completed
            // on that day
            user.onDayEnd(calendar.getTime());
            calendar.add(Calendar.DATE, 1);
        }
    }

    user.setLastLogin(currentDate);
    user.save();

    // initialize the list displaying all habits the user has
    expandableListView = (ExpandableListView) view.findViewById(R.id.HabitTypeExpandableListView);
    adapter = new ExpandableListViewAdapter(getContext(), user);
    expandableListView.setAdapter(adapter);

    expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int group, int child, long childRowId) {

            String category = SetUtilities.getItemAtIndex(user.getHabitCategories(), group);
            Habit habit = user.getHabitsInCategory(category).get(child);

            ArrayList<String> types = new ArrayList<>();
            types.addAll(user.getHabitCategories());

            startDetailsActivity(habit, types);

            return false;
        }
    });

}
 
开发者ID:CMPUT301F17T15,项目名称:CIA,代码行数:54,代码来源:HabitsFragment.java

示例11: onCreate

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


        // second level category names (genres)
        secondLevel.add(movies);
        secondLevel.add(games);
        // secondLevel.add(serials);

        // movies category all data
        thirdLevelMovies.put(movies[0], horror);
        thirdLevelMovies.put(movies[1], action);
        thirdLevelMovies.put(movies[2], thriller);


        // games category all data
        thirdLevelGames.put(games[0], fps);
        thirdLevelGames.put(games[1], moba);
        thirdLevelGames.put(games[2], rpg);
        thirdLevelGames.put(games[3], racing);


        // serials category all data
      /*  thirdLevelSerials.put(serials[0], crime);
        thirdLevelSerials.put(serials[1], family);
        thirdLevelSerials.put(serials[2], comedy);
*/


        // all data
        data.add(thirdLevelMovies);
        data.add(thirdLevelGames);
        //data.add(thirdLevelSerials);


        // expandable listview
        expandableListView = (ExpandableListView) findViewById(R.id.expandible_listview);

        // parent adapter
        ThreeLevelListAdapter threeLevelListAdapterAdapter = new ThreeLevelListAdapter(this, parent, secondLevel, data);


        // set adapter
        expandableListView.setAdapter( threeLevelListAdapterAdapter );


        // OPTIONAL : Show one list at a time
        expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
            int previousGroup = -1;

            @Override
            public void onGroupExpand(int groupPosition) {
                if (groupPosition != previousGroup)
                    expandableListView.collapseGroup(previousGroup);
                previousGroup = groupPosition;
            }
        });


    }
 
开发者ID:talhahasanzia,项目名称:Three-Level-Expandable-Listview,代码行数:63,代码来源:MainActivity.java

示例12: useNewAdapter

import android.widget.ExpandableListView; //导入方法依赖的package包/类
public void useNewAdapter() {
    ExpandableListView listView = (ExpandableListView)mRootView.findViewById(R.id.elvResults);
    mAdapter = new RaceResultsListAdapter(getContext(), AppState.getInstance().raceResults);
    listView.setAdapter(mAdapter);
}
 
开发者ID:voroshkov,项目名称:Chorus-RF-Laptimer,代码行数:6,代码来源:RaceResultFragment.java

示例13: onCreate

import android.widget.ExpandableListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_exception_list);
    componentName = getIntent().getStringExtra("componentName");

    tvName = (TextView) findViewById(R.id.textViewComponentName);
    tvName.setText(componentName);

    List<ExceptionReport> reportsFiltered = filterByComponentName(GlobalClass.reports);
    List<String> exceptionTypes = getExceptionTypesFromReports(reportsFiltered);

    mapIntent = organizeMalIntentssByExceptionType(exceptionTypes, reportsFiltered);


    expListView = (ExpandableListView) findViewById(R.id.expListView);

    ExpandableListAdapter listAdapter = new MalIntentExpandableListAdapter(this, exceptionTypes, mapIntent);

    // setting list adapter
    expListView.setAdapter(listAdapter);

}
 
开发者ID:lmartire,项目名称:DoApp,代码行数:24,代码来源:ExceptionListActivity.java


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