android.widget.ListView#getContext ( )源码实例Demo

下面列出了android.widget.ListView#getContext ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Dashchan   文件: ThreadshotPerformer.java
public ThreadshotPerformer(ListView listView, UiManager uiManager, String chanName, String boardName,
		String threadNumber, String threadTitle, List<PostItem> postItems) {
	this.listView = listView;
	this.uiManager = uiManager;
	this.chanName = chanName;
	this.boardName = boardName;
	this.threadNumber = threadNumber;
	this.threadTitle = threadTitle;
	this.postItems = postItems;
	dialog = new ProgressDialog(listView.getContext());
	dialog.setMessage(listView.getContext().getString(R.string.message_processing_data));
	dialog.setCanceledOnTouchOutside(false);
	dialog.setOnCancelListener(this);
	dialog.show();
	// isBusy == true, because I must prevent view handling in main thread
	demandSet.isBusy = true;
	demandSet.selectionMode = UiManager.SELECTION_THREADSHOT;
	asyncTask.executeOnExecutor(ConcurrentUtils.SEPARATE_EXECUTOR);
}
 
源代码2 项目: ALLGO   文件: FadingActionBarHelperBase.java
private View createListView(ListView listView) {
    mContentContainer = (ViewGroup) mInflater.inflate(R.layout.fab__listview_container, null);
    mContentContainer.addView(mContentView);

    mHeaderContainer = (FrameLayout) mContentContainer.findViewById(R.id.fab__header_container);
    initializeGradient(mHeaderContainer);
    mHeaderContainer.addView(mHeaderView, 0);

    mMarginView = new FrameLayout(listView.getContext());
    mMarginView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, 0));
    listView.addHeaderView(mMarginView, null, false);

    // Make the background as high as the screen so that it fills regardless of the amount of scroll. 
    mListViewBackgroundView = mContentContainer.findViewById(R.id.fab__listview_background);
    FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mListViewBackgroundView.getLayoutParams();
    params.height = Utils.getDisplayHeight(listView.getContext());
    mListViewBackgroundView.setLayoutParams(params);

    listView.setOnScrollListener(mOnScrollListener);
    return mContentContainer;
}
 
private View createListView(ListView listView) {
    ViewGroup contentContainer = (ViewGroup) mInflater.inflate(R.layout.fab__listview_container, null);
    contentContainer.addView(mContentView);

    mHeaderContainer = (FrameLayout) contentContainer.findViewById(R.id.fab__header_container);
    initializeGradient(mHeaderContainer);
    mHeaderContainer.addView(mHeaderView, 0);

    mMarginView = new FrameLayout(listView.getContext());
    mMarginView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, 0));
    listView.addHeaderView(mMarginView, null, false);

    // Make the background as high as the screen so that it fills regardless of the amount of scroll. 
    mListViewBackgroundView = contentContainer.findViewById(R.id.fab__listview_background);
    FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mListViewBackgroundView.getLayoutParams();
    params.height = Utils.getDisplayHeight(listView.getContext());
    mListViewBackgroundView.setLayoutParams(params);

    listView.setOnScrollListener(mOnScrollListener);
    return contentContainer;
}
 
private View createListView(ListView listView) {
    ViewGroup contentContainer = (ViewGroup) mInflater.inflate(R.layout.fab__listview_container, null);
    contentContainer.addView(mContentView);

    mHeaderContainer = (FrameLayout) contentContainer.findViewById(R.id.fab__header_container);
    initializeGradient(mHeaderContainer);
    mHeaderContainer.addView(mHeaderView, 0);

    mMarginView = new FrameLayout(listView.getContext());
    mMarginView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, 0));
    listView.addHeaderView(mMarginView, null, false);

    // Make the background as high as the screen so that it fills regardless of the amount of scroll. 
    mListViewBackgroundView = contentContainer.findViewById(R.id.fab__listview_background);
    FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mListViewBackgroundView.getLayoutParams();
    params.height = Utils.getDisplayHeight(listView.getContext());
    mListViewBackgroundView.setLayoutParams(params);

    listView.setOnScrollListener(mOnScrollListener);
    return contentContainer;
}
 
private View createListView(ListView listView) {
    ViewGroup contentContainer = (ViewGroup) mInflater.inflate(R.layout.fab__listview_container, null);
    contentContainer.addView(mContentView);

    mHeaderContainer = (FrameLayout) contentContainer.findViewById(R.id.fab__header_container);
    initializeGradient(mHeaderContainer);
    mHeaderContainer.addView(mHeaderView, 0);

    mMarginView = new FrameLayout(listView.getContext());
    mMarginView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, 0));
    listView.addHeaderView(mMarginView, null, false);

    // Make the background as high as the screen so that it fills regardless of the amount of scroll. 
    mListViewBackgroundView = contentContainer.findViewById(R.id.fab__listview_background);
    FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mListViewBackgroundView.getLayoutParams();
    params.height = Utils.getDisplayHeight(listView.getContext());
    mListViewBackgroundView.setLayoutParams(params);

    listView.setOnScrollListener(mOnScrollListener);
    return contentContainer;
}
 
private View createListView(ListView listView) {
    ViewGroup contentContainer = (ViewGroup) mInflater.inflate(R.layout.fab__listview_container, null);
    contentContainer.addView(mContentView);

    mHeaderContainer = (FrameLayout) contentContainer.findViewById(R.id.fab__header_container);
    initializeGradient(mHeaderContainer);
    mHeaderContainer.addView(mHeaderView, 0);

    mMarginView = new FrameLayout(listView.getContext());
    mMarginView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, 0));
    listView.addHeaderView(mMarginView, null, false);

    // Make the background as high as the screen so that it fills regardless of the amount of scroll. 
    mListViewBackgroundView = contentContainer.findViewById(R.id.fab__listview_background);
    FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mListViewBackgroundView.getLayoutParams();
    params.height = Utils.getDisplayHeight(listView.getContext());
    mListViewBackgroundView.setLayoutParams(params);

    listView.setOnScrollListener(mOnScrollListener);
    return contentContainer;
}
 
源代码7 项目: GravityBox   文件: TileOrderActivity.java
void showMenu(final ListView listView, final View anchorView) {
    final PopupMenu menu = new PopupMenu(listView.getContext(), anchorView);
    menu.inflate(R.menu.tile_menu);
    menu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
                case R.id.tile_dual:
                    dual = !dual;
                    break;
                case R.id.tile_locked:
                    locked = !locked;
                    if (locked) {
                        secured = true;
                        lockedOnly = false;
                    }
                    break;
                case R.id.tile_locked_only:
                    lockedOnly = !lockedOnly;
                    break;
                case R.id.tile_secured:
                    secured = !secured;
                    break;
            }
            updateMenu(menu.getMenu());
            listView.invalidateViews();
            return true;
        }
    });
    updateMenu(menu.getMenu());
    menu.show();
}