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


Java ListPopupWindow.setOnItemClickListener方法代码示例

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


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

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

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

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

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

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

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

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

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

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

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

示例13: RecipientEditTextView

import android.widget.ListPopupWindow; //导入方法依赖的package包/类
public RecipientEditTextView(Context context, AttributeSet attrs) {
    super(context, attrs);
    setChipDimensions(context, attrs);
    if (sSelectedTextColor == -1) {
        sSelectedTextColor = context.getResources().getColor(android.R.color.white);
    }
    mAlternatesPopup = new ListPopupWindow(context);
    mAddressPopup = new ListPopupWindow(context);
    mCopyDialog = new Dialog(context);
    mAlternatesListener = new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView,View view, int position,
                long rowId) {
            mAlternatesPopup.setOnItemClickListener(null);
            replaceChip(mSelectedChip, ((RecipientAlternatesAdapter) adapterView.getAdapter())
                    .getRecipientEntry(position));
            Message delayed = Message.obtain(mHandler, DISMISS);
            delayed.obj = mAlternatesPopup;
            mHandler.sendMessageDelayed(delayed, DISMISS_DELAY);
            clearComposingText();
        }
    };
    setInputType(getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    setOnItemClickListener(this);
    setCustomSelectionActionModeCallback(this);
    mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            if (msg.what == DISMISS) {
                ((ListPopupWindow) msg.obj).dismiss();
                return;
            }
            super.handleMessage(msg);
        }
    };
    mTextWatcher = new RecipientTextWatcher();
    addTextChangedListener(mTextWatcher);
    mGestureDetector = new GestureDetector(context, this);
    setOnEditorActionListener(this);
}
 
开发者ID:CommonQ,项目名称:sms_DualCard,代码行数:41,代码来源:RecipientEditTextView.java

示例14: showAlternates

import android.widget.ListPopupWindow; //导入方法依赖的package包/类
private void showAlternates(RecipientChip currentChip, ListPopupWindow alternatesPopup,
        int width, Context context) {
    int line = getLayout().getLineForOffset(getChipStart(currentChip));
    int bottom;
    if (line == getLineCount() -1) {
        bottom = 0;
    } else {
        bottom = -(int) ((mChipHeight + (2 * mLineSpacingExtra)) * (Math.abs(getLineCount() - 1
                - line)));
    }
    // Align the alternates popup with the left side of the View,
    // regardless of the position of the chip tapped.
    alternatesPopup.setWidth(width);
    alternatesPopup.setAnchorView(this);
    alternatesPopup.setVerticalOffset(bottom);
    alternatesPopup.setAdapter(createAlternatesAdapter(currentChip));
    alternatesPopup.setOnItemClickListener(mAlternatesListener);
    // Clear the checked item.
    mCheckedItem = -1;
    alternatesPopup.show();
    ListView listView = alternatesPopup.getListView();
    listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    // Checked item would be -1 if the adapter has not
    // loaded the view that should be checked yet. The
    // variable will be set correctly when onCheckedItemChanged
    // is called in a separate thread.
    if (mCheckedItem != -1) {
        listView.setItemChecked(mCheckedItem, true);
        mCheckedItem = -1;
    }
}
 
开发者ID:CommonQ,项目名称:sms_DualCard,代码行数:32,代码来源:RecipientEditTextView.java

示例15: StripLayoutHelper

import android.widget.ListPopupWindow; //导入方法依赖的package包/类
/**
 * Creates an instance of the {@link StripLayoutHelper}.
 * @param context         The current Android {@link Context}.
 * @param updateHost      The parent {@link LayoutUpdateHost}.
 * @param renderHost      The {@link LayoutRenderHost}.
 * @param incognito       Whether or not this tab strip is incognito.
 */
public StripLayoutHelper(Context context, LayoutUpdateHost updateHost,
        LayoutRenderHost renderHost, boolean incognito) {
    mTabOverlapWidth = TAB_OVERLAP_WIDTH_DP;
    mNewTabButtonWidth = NEW_TAB_BUTTON_WIDTH_DP;

    mRightMargin = LocalizationUtils.isLayoutRtl() ? 0 : mNewTabButtonWidth;
    mLeftMargin = LocalizationUtils.isLayoutRtl() ? mNewTabButtonWidth : 0;
    mMinTabWidth = MIN_TAB_WIDTH_DP;
    mMaxTabWidth = MAX_TAB_WIDTH_DP;
    mReorderMoveStartThreshold = REORDER_MOVE_START_THRESHOLD_DP;
    mUpdateHost = updateHost;
    mRenderHost = renderHost;
    mNewTabButton =
            new CompositorButton(context, NEW_TAB_BUTTON_WIDTH_DP, NEW_TAB_BUTTON_HEIGHT_DP);
    mNewTabButton.setResources(R.drawable.btn_tabstrip_new_tab_normal,
            R.drawable.btn_tabstrip_new_tab_pressed,
            R.drawable.btn_tabstrip_new_incognito_tab_normal,
            R.drawable.btn_tabstrip_new_incognito_tab_pressed);
    mNewTabButton.setIncognito(incognito);
    mNewTabButton.setY(NEW_TAB_BUTTON_Y_OFFSET_DP);
    mNewTabButton.setClickSlop(NEW_TAB_BUTTON_CLICK_SLOP_DP);
    Resources res = context.getResources();
    mNewTabButton.setAccessibilityDescription(
            res.getString(R.string.accessibility_toolbar_btn_new_tab),
            res.getString(R.string.accessibility_toolbar_btn_new_incognito_tab));
    mContext = context;
    mIncognito = incognito;
    mBrightness = 1.f;

    // Create tab menu
    mTabMenu = new ListPopupWindow(mContext);
    mTabMenu.setAdapter(new ArrayAdapter<String>(mContext, R.layout.bookmark_popup_item,
            new String[] {
                    mContext.getString(!mIncognito ? R.string.menu_close_all_tabs
                                                   : R.string.menu_close_all_incognito_tabs)}));
    mTabMenu.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            mTabMenu.dismiss();
            if (position == ID_CLOSE_ALL_TABS) {
                mModel.closeAllTabs(false, false);
            }
        }
    });

    int menuWidth = mContext.getResources().getDimensionPixelSize(R.dimen.menu_width);
    mTabMenu.setWidth(menuWidth);
    mTabMenu.setModal(true);

    int screenWidthDp = context.getResources().getConfiguration().screenWidthDp;
    mShouldCascadeTabs = screenWidthDp >= DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP;
    mStripStacker = mShouldCascadeTabs ? mCascadingStripStacker : mScrollingStripStacker;
    mIsFirstLayoutPass = true;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:62,代码来源:StripLayoutHelper.java


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