當前位置: 首頁>>代碼示例>>Java>>正文


Java ListPopupWindow類代碼示例

本文整理匯總了Java中android.widget.ListPopupWindow的典型用法代碼示例。如果您正苦於以下問題:Java ListPopupWindow類的具體用法?Java ListPopupWindow怎麽用?Java ListPopupWindow使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ListPopupWindow類屬於android.widget包,在下文中一共展示了ListPopupWindow類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showAddress

import android.widget.ListPopupWindow; //導入依賴的package包/類
private void showAddress(final DrawableRecipientChip currentChip, final ListPopupWindow popup,
                         int width) {
    if (!mAttachedToWindow) {
        return;
    }
    int line = getLayout().getLineForOffset(getChipStart(currentChip));
    int bottom = calculateOffsetFromBottom(line);
    // Align the alternates popup with the left side of the View,
    // regardless of the position of the chip tapped.
    popup.setWidth(width);
    popup.setAnchorView(this);
    popup.setVerticalOffset(bottom);
    popup.setAdapter(createSingleAddressAdapter(currentChip));
    popup.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            unselectChip(currentChip);
            popup.dismiss();
        }
    });
    popup.show();
    ListView listView = popup.getListView();
    listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    listView.setItemChecked(0, true);
}
 
開發者ID:jianliaoim,項目名稱:talk-android,代碼行數:26,代碼來源:RecipientEditTextView.java

示例2: initView

import android.widget.ListPopupWindow; //導入依賴的package包/類
private void initView(Context context) {
    // TODO: validator?

    alternatesPopup = new ListPopupWindow(context);
    alternatesAdapter = new AlternateRecipientAdapter(context, this);
    alternatesPopup.setAdapter(alternatesAdapter);

    // don't allow duplicates, based on equality of recipient objects, which is e-mail addresses
    allowDuplicates(false);

    // if a token is completed, pick an entry based on best guess.
    // Note that we override performCompletion, so this doesn't actually do anything
    performBestGuess(true);

    adapter = new RecipientAdapter(context);
    setAdapter(adapter);

    setLongClickable(true);
}
 
開發者ID:philipwhiuk,項目名稱:q-mail,代碼行數:20,代碼來源:RecipientSelectView.java

示例3: showDownloadTypeChooser

import android.widget.ListPopupWindow; //導入依賴的package包/類
private void showDownloadTypeChooser(View anchor) {
    //noinspection ConstantConditions
    final ListPopupWindow popupWindow = new ListPopupWindow(getContext());
    SimpleDropDownAdapter<Integer> adapter = new SimpleDropDownAdapter<>(
            getContext(), mDownloadTypes, mModel.downloadType);
    popupWindow.setAnchorView(anchor);
    popupWindow.setAdapter(adapter);
    popupWindow.setContentWidth(adapter.measureContentWidth());
    popupWindow.setOnItemClickListener((parent, view, position, id) -> {
        popupWindow.dismiss();

        // Update the view
        mModel.downloadType = mDownloadTypes.get(position);
        mBinding.downloadCommands
                .from(mDownloadCommands.get(mModel.downloadType))
                .update();
        mBinding.setModel(mModel);
        mBinding.executePendingBindings();
    });
    popupWindow.setModal(true);
    popupWindow.show();
}
 
開發者ID:jruesga,項目名稱:rview,代碼行數:23,代碼來源:DownloadDialogFragment.java

示例4: initPopup

import android.widget.ListPopupWindow; //導入依賴的package包/類
private void initPopup() {
	View menuItemView = getActivity().findViewById(R.id.pick_category);
	listPopupWindow = new ListPopupWindow(getActivity());
	listPopupWindow.setAnchorView(menuItemView);
	listPopupWindow.setModal(true);
	listPopupWindow.setWidth(categoryListWidth);
	listPopupWindow.setHeight(ListPopupWindow.WRAP_CONTENT);
	listPopupWindow
			.setOnDismissListener(new PopupWindow.OnDismissListener() {
				@Override
				public void onDismiss() {
					if (ourListAdapter != null)
						ourListAdapter.notifyDataSetChanged();
				}
			});
}
 
開發者ID:simonjrp,項目名稱:ESCAPE,代碼行數:17,代碼來源:TaskListFragment.java

示例5: showDropDown

import android.widget.ListPopupWindow; //導入依賴的package包/類
public void showDropDown() {
    if (mPopup.getAnchorView() == null) {
        if (mDropDownAnchorId != View.NO_ID) {
            mPopup.setAnchorView(getRootView().findViewById(mDropDownAnchorId));
        } else {
            mPopup.setAnchorView(this);
        }
    }
    if (!isPopupShowing()) {
        // Make sure the list does not obscure the IME when shown for the first time.
        mPopup.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NEEDED);
    }

    requestFocus();
    mPopup.show();
    mPopup.getListView().setOverScrollMode(View.OVER_SCROLL_ALWAYS);

    if (mOnShowListener != null) {
        mOnShowListener.onShow();
    }
}
 
開發者ID:xyxyLiu,項目名稱:Edit-Spinner,代碼行數:22,代碼來源:EditSpinner.java

示例6: getVerticalOffset

import android.widget.ListPopupWindow; //導入依賴的package包/類
public static int getVerticalOffset(ListPopupWindow popupWindow, View anchorView, int position, int contentHeight) {
    final int shadow = calculateVerticalShadow(popupWindow);
    int offset = -shadow;

    if ((position & PopupGravity.BOTTOM) == PopupGravity.BOTTOM || (position & PopupDirection.DOWN) == PopupDirection.DOWN) {
        offset += 0;
    }

    if ((position & PopupGravity.TOP) == PopupGravity.TOP) {
        offset += -anchorView.getHeight();
    }

    if ((position & PopupGravity.CENTER_VERTICAL) == PopupGravity.CENTER_VERTICAL || (position & PopupGravity.CENTER) == PopupGravity.CENTER) {
        offset += -anchorView.getHeight() / 2;
    }

    if ((position & PopupDirection.UP) == PopupDirection.UP) {
        offset += -contentHeight - anchorView.getHeight() - (2 * shadow);
    }

    return offset;
}
 
開發者ID:rafakob,項目名稱:PopupList,代碼行數:23,代碼來源:ListUtils.java

示例7: getHorizontalOffset

import android.widget.ListPopupWindow; //導入依賴的package包/類
public static int getHorizontalOffset(ListPopupWindow popupWindow, View anchorView, int position, int contentWidth) {
    final int shadow = calculateHorizontalShadow(popupWindow);
    int offset = -shadow;

    if ((position & PopupGravity.LEFT) == PopupGravity.LEFT) {
        offset += 0;
    }

    if ((position & PopupGravity.RIGHT) == PopupGravity.RIGHT) {
        offset += anchorView.getWidth();
    }

    if ((position & PopupGravity.CENTER_HORIZONTAL) == PopupGravity.CENTER_HORIZONTAL || (position & PopupGravity.CENTER) == PopupGravity.CENTER) {
        offset += anchorView.getWidth() / 2;
    }

    if ((position & PopupDirection.LEFT) == PopupDirection.LEFT) {
        offset += -contentWidth;
    }

    return offset;
}
 
開發者ID:rafakob,項目名稱:PopupList,代碼行數:23,代碼來源:ListUtils.java

示例8: setupList

import android.widget.ListPopupWindow; //導入依賴的package包/類
private void setupList() {
    mPopup = new ListPopupWindow(mContext);
    mPopup.setAdapter(mAdapter);
    mPopup.setAnchorView(mAnchorView);
    mContentWidth = ListUtils.measureListContentWidth(mAdapter, mContext);
    mContentHeight = ListUtils.measureListContentHeight(mAdapter, mContext);
    mPopup.setContentWidth(mContentWidth);
    mPopup.setModal(mIsModal);
    mPopup.setOnDismissListener(mOnDismissListener);
    mPopup.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (mOnPopupListItemListener != null)
                mOnPopupListItemListener.onPopupListItemClicked(new PopupItem(mAdapter.getItem(position)));
            mPopup.dismiss();
        }
    });

    if (mAnimationStyle != -1) {
        mPopup.setAnimationStyle(mAnimationStyle);
    }
}
 
開發者ID:rafakob,項目名稱:PopupList,代碼行數:23,代碼來源:PopupList.java

示例9: disableHideOnOutsideTap

import android.widget.ListPopupWindow; //導入依賴的package包/類
/**
 * Disable hiding on outside tap so that tapping on a text input field associated with the popup
 * will not hide the popup.
 */
public void disableHideOnOutsideTap() {
    // HACK: The ListPopupWindow's mPopup automatically dismisses on an outside tap. There's
    // no way to override it or prevent it, except reaching into ListPopupWindow's hidden
    // API. This allows the C++ controller to completely control showing/hiding the popup.
    // See http://crbug.com/400601
    try {
        Method setForceIgnoreOutsideTouch = ListPopupWindow.class.getMethod(
                "setForceIgnoreOutsideTouch", new Class[] { boolean.class });
        setForceIgnoreOutsideTouch.invoke(this, new Object[] { true });
    } catch (Exception e) {
        Log.e("AutofillPopup",
                "ListPopupWindow.setForceIgnoreOutsideTouch not found",
                e);
    }
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:20,代碼來源:DropdownPopupWindow.java

示例10: init

import android.widget.ListPopupWindow; //導入依賴的package包/類
@SuppressWarnings("unchecked")
protected void init()
{
    super.init();

    addAttrDescAN(new AttrDescView_widget_AutoCompleteTextView_completionHint(this));
    addAttrDescAN(new AttrDescView_widget_AutoCompleteTextView_completionHintView(this));
    addAttrDescAN(new AttrDescReflecMethodInt(this, "completionThreshold", "setThreshold", 2));
    addAttrDescAN(new AttrDescReflecMethodId(this, "dropDownAnchor", -1));
    addAttrDescAN(new AttrDescReflecMethodDimensionWithNameInt(this, "dropDownHeight", (float) ViewGroup.LayoutParams.WRAP_CONTENT));
    addAttrDescAN(new AttrDescReflecMethodDimensionIntFloor(this, "dropDownHorizontalOffset", 0.0f));
    addAttrDescAN(new AttrDescReflecFieldMethodDrawable(this, "dropDownSelector", "mPopup", ListPopupWindow.class, "setListSelector", null)); // Hay un background por defecto de Android en ListPopupWindow aunque parece que por defecto se pone un null si no hay atributo
    addAttrDescAN(new AttrDescReflecMethodDimensionIntFloor(this, "dropDownVerticalOffset", 0.0f));
    addAttrDescAN(new AttrDescReflecMethodDimensionWithNameInt(this, "dropDownWidth", (float) ViewGroup.LayoutParams.WRAP_CONTENT));
    addAttrDescAN(new AttrDescReflecMethodDrawable(this, "popupBackground", "setDropDownBackgroundDrawable", "@null"));
}
 
開發者ID:jmarranz,項目名稱:itsnat_droid,代碼行數:17,代碼來源:ClassDescView_widget_AutoCompleteTextView.java

示例11: onClick

import android.widget.ListPopupWindow; //導入依賴的package包/類
@Override
public void onClick(View v) {
	//TODO: refactor/redesign
   	final int regionId = v.getId();
   	final List<Integer> listsRegionsId = mRegionsDB.getAllThemesIds();
    final ListPopupWindow listThemesPopupWindow = new ListPopupWindow(mActivity);
    listThemesPopupWindow.setAdapter(new ArrayAdapter<String>(mActivity, R.layout.list_item_theme, mRegionsDB.getAllThemesNames()));
    listThemesPopupWindow.setModal(true);
       listThemesPopupWindow.setAnchorView(v);
    OnItemClickListener itemClickListener = new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view,
	            int position, long id) {
        	changeTheme(regionId, listsRegionsId.get(position));
        	listThemesPopupWindow.dismiss();
        	((EditorActivity)mActivity).refreshTable();
	        }	    	
		};
    listThemesPopupWindow.setOnItemClickListener(itemClickListener); 
    listThemesPopupWindow.show();		
}
 
開發者ID:angelj-a,項目名稱:musicalgps,代碼行數:21,代碼來源:RegionEditor.java

示例12: showAddress

import android.widget.ListPopupWindow; //導入依賴的package包/類
private void showAddress(final RecipientChip currentChip, final ListPopupWindow popup,
        int width, Context context) {
    int line = getLayout().getLineForOffset(getChipStart(currentChip));
    int bottom = calculateOffsetFromBottom(line);
    // Align the alternates popup with the left side of the View,
    // regardless of the position of the chip tapped.
    popup.setWidth(width);
    popup.setAnchorView(this);
    popup.setVerticalOffset(bottom);
    popup.setAdapter(createSingleAddressAdapter(currentChip));
    popup.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            unselectChip(currentChip);
            popup.dismiss();
        }
    });
    popup.show();
    ListView listView = popup.getListView();
    listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    listView.setItemChecked(0, true);
}
 
開發者ID:CommonQ,項目名稱:sms_DualCard,代碼行數:23,代碼來源:RecipientEditTextView.java

示例13: showAddress

import android.widget.ListPopupWindow; //導入依賴的package包/類
private void showAddress(final DrawableRecipientChip currentChip,final ListPopupWindow popup,final int width)
{
if(!mAttachedToWindow)
  return;
final int line=getLayout().getLineForOffset(getChipStart(currentChip));
final int bottom=calculateOffsetFromBottom(line);
// Align the alternates popup with the left side of the View,
// regardless of the position of the chip tapped.
popup.setWidth(width);
popup.setAnchorView(this);
popup.setVerticalOffset(bottom);
popup.setAdapter(createSingleAddressAdapter(currentChip));
popup.setOnItemClickListener(new OnItemClickListener()
  {
    @Override
    public void onItemClick(final AdapterView<?> parent,final View view,final int position,final long id)
      {
      unselectChip(currentChip);
      popup.dismiss();
      }
  });
popup.show();
final ListView listView=popup.getListView();
listView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
listView.setItemChecked(0,true);
}
 
開發者ID:AndroidDeveloperLB,項目名稱:ChipsLibrary,代碼行數:27,代碼來源:RecipientEditTextView.java

示例14: showListPopupWindow

import android.widget.ListPopupWindow; //導入依賴的package包/類
protected void showListPopupWindow() {
  ArrayAdapter<String> adapter=
    new ArrayAdapter<>(this, android.R.layout.simple_list_item_1,
      ITEMS);
  final ListPopupWindow popup=new ListPopupWindow(this);

  popup.setAnchorView(popupAnchor);
  popup.setAdapter(adapter);
  popup.setOnItemClickListener(
    new AdapterView.OnItemClickListener() {
      @Override
      public void onItemClick(AdapterView<?> parent, View view,
                              int position, long id) {
        popup.dismiss();
      }
    });
  popup.show();
}
 
開發者ID:commonsguy,項目名稱:cwac-security,代碼行數:19,代碼來源:MainActivity.java

示例15: initPopup

import android.widget.ListPopupWindow; //導入依賴的package包/類
private void initPopup() {
	View menuItemView = getActivity().findViewById(R.id.pick_category);
	listPopupWindow = new ListPopupWindow(getActivity());
	listPopupWindow.setAnchorView(menuItemView);
	listPopupWindow.setModal(true);
	listPopupWindow.setWidth(categoryListWidth);
	listPopupWindow.setHeight(ListPopupWindow.WRAP_CONTENT);
	listPopupWindow
			.setOnDismissListener(new PopupWindow.OnDismissListener() {
				@Override
				public void onDismiss() {
					if (listAdapter != null)
						listAdapter.notifyDataSetChanged();
				}
			});
}
 
開發者ID:simonjrp,項目名稱:ESCAPE,代碼行數:17,代碼來源:ExpandableEventListFragment.java


注:本文中的android.widget.ListPopupWindow類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。