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


Java ListPopupWindow.setAnchorView方法代碼示例

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


在下文中一共展示了ListPopupWindow.setAnchorView方法的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: 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

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

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

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

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

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

示例10: createPopWindow

import android.widget.ListPopupWindow; //導入方法依賴的package包/類
private void createPopWindow(){
    popupWindow = new ListPopupWindow(getContext());
    popupAdapter = new SelectorAdapter();
    popupWindow.setAnchorView(parent.getChildAt(0));
    popupWindow.setAdapter(popupAdapter);
    popupWindow.setWidth(WindowManager.LayoutParams.MATCH_PARENT);
    popupWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
    //獲取焦點
    popupWindow.setModal(true);

    popupWindow.setOnItemClickListener(this);
    popupWindow.setOnDismissListener(this);
}
 
開發者ID:newbiechen1024,項目名稱:NovelReader,代碼行數:14,代碼來源:SelectorView.java

示例11: ActionBarSubmenu

import android.widget.ListPopupWindow; //導入方法依賴的package包/類
/*******************************************************************
** ActionBarSubmenu API
*******************************************************************/

public ActionBarSubmenu(Context context, LayoutInflater inflater, View anchor) {
    mContext = context;

    mItemList = new ArrayList<SubmenuItemData>();
    mSelectedPosition = 0;   // default value
    mSubmenuItemTitleMaxWidth = 0;

    mAdapter = new ActionBarSubmenuAdapter(inflater);

    mPopupWindow = new ListPopupWindow(context, null);
    mPopupWindow.setAdapter(mAdapter);
    mPopupWindow.setModal(true);
    mPopupWindow.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(context,R.color.primary_material_dark)));
    mPopupWindow.setAnchorView(anchor);
    mPopupWindow.setOnItemClickListener(this);

    // Get the size of the font used to display the submenu items
    TypedValue typedValue = new TypedValue();
    context.getTheme().resolveAttribute(android.R.attr.textAppearanceLarge, typedValue, true);
    int[] attribute = new int[] { android.R.attr.textSize };
    TypedArray array = context.obtainStyledAttributes(typedValue.resourceId, attribute);
    mSubmenuFontSize = array.getDimensionPixelSize(0, -1);
    array.recycle();

    // Get the size of the radio button bitmap
    mRadioButtonWidth = context.getResources().getDimensionPixelSize(R.dimen.radio_button_width);
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:32,代碼來源:ActionBarSubmenu.java

示例12: createPopupFolderList

import android.widget.ListPopupWindow; //導入方法依賴的package包/類
/** 創建彈出的ListView */
private void createPopupFolderList(int width, int height) {
    mFolderPopupWindow = new ListPopupWindow(this);
    mFolderPopupWindow.setBackgroundDrawable(null);
    mFolderPopupWindow.setAdapter(mImageFolderAdapter);
    mFolderPopupWindow.setContentWidth(width);
    mFolderPopupWindow.setWidth(width);  //如果不設置,就是 AnchorView 的寬度
    mFolderPopupWindow.setHeight(height * 5 / 8);
    mFolderPopupWindow.setAnchorView(mFooterBar);  //ListPopupWindow總會相對於這個View
    mFolderPopupWindow.setModal(false);  //是否為模態,影響返回鍵的處理
    mFolderPopupWindow.setAnimationStyle(R.style.popupwindow_anim_style);
    mFolderPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            backgroundAlpha(1.0f);
        }
    });
    mFolderPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
            mImageFolderAdapter.setSelectIndex(position);
            imagePicker.setCurrentImageFolderPosition(position);
            mFolderPopupWindow.dismiss();
            ImageFolder imageFolder = (ImageFolder) adapterView.getAdapter().getItem(position);
            if (null != imageFolder) {
                mImageGridAdapter.refreshData(imageFolder.images);
                mBtnDir.setText(imageFolder.name);
            }
            gv_photo_list.smoothScrollToPosition(0);//滑動到頂部
        }
    });
}
 
開發者ID:dyzs,項目名稱:YinjiImageEditor,代碼行數:33,代碼來源:PhotoMutiSelectActivity.java

示例13: initPopupWindow

import android.widget.ListPopupWindow; //導入方法依賴的package包/類
private void initPopupWindow() {
    popupWindow = new ListPopupWindow(mContext) {

        @Override
        public void show() {
            super.show();
            mRightImageTopView.setClickable(true);
            mRightIv.startAnimation(mAnimation);
        }

        @Override
        public void dismiss() {
            super.dismiss();
        }

    };
    popupWindow.setOnItemClickListener(this);
    popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    popupWindow.setPromptPosition(ListPopupWindow.POSITION_PROMPT_BELOW);
    popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
    popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
    popupWindow.setAnchorView(editText);
    popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            popupWindowHideTime = System.currentTimeMillis();
            mRightIv.startAnimation(mResetAnimation);
        }
    });
}
 
開發者ID:WrBug,項目名稱:EditSpinner,代碼行數:31,代碼來源:EditSpinner.java

示例14: createPopupFolderList

import android.widget.ListPopupWindow; //導入方法依賴的package包/類
private void createPopupFolderList() {
    mFolderPopupWindow = new ListPopupWindow(this);
    mFolderPopupWindow.setAdapter(mFolderAdapter);
    mFolderPopupWindow.setContentWidth(ListPopupWindow.MATCH_PARENT);
    mFolderPopupWindow.setWidth(ListPopupWindow.MATCH_PARENT);
    mFolderPopupWindow.setHeight(ListPopupWindow.MATCH_PARENT);
    mFolderPopupWindow.setAnchorView(toolbar);
    mFolderPopupWindow.setModal(true);
    mFolderPopupWindow.setAnimationStyle(R.style.popwindow_anim_style);
    mFolderPopupWindow.setOnItemClickListener(this);
}
 
開發者ID:gzsll,項目名稱:TLint,代碼行數:12,代碼來源:GalleryActivity.java

示例15: createPopUps

import android.widget.ListPopupWindow; //導入方法依賴的package包/類
private void createPopUps() {
    //Create the Adapter
    if (mAdapterReference == null) {
        mAdapterItemType = new ArrayAdapter(getContext(), R.layout.reference_spinner_item, new String[]{"Simple Item", "Expandable", "Expandable Section", "Section"});
        mAdapterReference = new ArrayAdapter(getContext(), R.layout.reference_spinner_item, getListener().getReferenceList());
    }
    //Setting up the popups
    Log.d(TAG, "Setting up the Popups");
    //Item Type
    mPopupItemType = new ListPopupWindow(getContext());
    mPopupItemType.setAnchorView(mBottomSheetDialog.findViewById(R.id.select_item_type));
    mPopupItemType.setModal(true);
    mPopupItemType.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NOT_NEEDED);
    mPopupItemType.setAnimationStyle(android.R.style.Animation_Dialog);
    mPopupItemType.setAdapter(mAdapterItemType);
    mPopupItemType.setVerticalOffset(-100);

    //Header Reference
    mPopupReference = new ListPopupWindow(getContext());
    mPopupReference.setAnchorView(mBottomSheetDialog.findViewById(R.id.select_reference_button));
    mPopupReference.setModal(true);
    mPopupReference.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NOT_NEEDED);
    mPopupReference.setAnimationStyle(android.R.style.Animation_Dialog);
    mPopupReference.setAdapter(mAdapterReference);
    mPopupReference.setVerticalOffset(-100);
    if (mAdapterReference.getCount() > 6)
        mPopupReference.setHeight(getResources().getDimensionPixelSize(R.dimen.popup_max_height));
}
 
開發者ID:davideas,項目名稱:FlexibleAdapter,代碼行數:29,代碼來源:BottomSheetSectionDialog.java


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