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


Java ListPopupWindow.show方法代码示例

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


在下文中一共展示了ListPopupWindow.show方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

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

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

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

示例7: onLongClick

import android.widget.ListPopupWindow; //导入方法依赖的package包/类
@Override public boolean onLongClick(View v) {
	String[] versions = { "Camera", "Laptop", "Watch", "Smartphone",
			"Television" };
	final ListPopupWindow listPopupWindow = new ListPopupWindow(
			getActivity());
	listPopupWindow.setAdapter(new ArrayAdapter<String>(getActivity(),
			android.R.layout.simple_dropdown_item_1line, versions));
	listPopupWindow.setAnchorView(mListPopupButton);
	listPopupWindow.setWidth(300);
	listPopupWindow.setHeight(400);

	listPopupWindow.setModal(true);
	listPopupWindow.show();
	return false;
}
 
开发者ID:negusoft,项目名称:GreenMatter,代码行数:16,代码来源:ButtonFragment.java

示例8: show_setsLastListPopupWindow

import android.widget.ListPopupWindow; //导入方法依赖的package包/类
@Test
public void show_setsLastListPopupWindow() throws Exception {
  Context context = Robolectric.application;
  ListPopupWindow popupWindow = new ListPopupWindow(context);
  assertThat(ShadowListPopupWindow.getLatestListPopupWindow()).isNull();
  popupWindow.setAnchorView(new View(context));
  popupWindow.show();
  assertThat(ShadowListPopupWindow.getLatestListPopupWindow()).isSameAs(popupWindow);
}
 
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:10,代码来源:ListPopupWindowTest.java

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

示例10: onPreferenceTreeClick

import android.widget.ListPopupWindow; //导入方法依赖的package包/类
@Override
public boolean onPreferenceTreeClick(Preference preference) {
    View preferenceView = getListView().findViewHolderForAdapterPosition(preference.getOrder()).itemView;

    switch (preference.getKey()) {
        case Common.PREF_LOCATION_UPDATE_INTERVAL:
            ListPopupWindow listPopupWindow = new ListPopupWindow(getActivity());
            listPopupWindow.setAnchorView(preferenceView);
            listPopupWindow.setAdapter(new ArrayAdapter<>(getActivity(), android.support.design.R.layout.support_simple_spinner_dropdown_item, getResources().getStringArray(R.array.location_update_interval_summaries)));
            listPopupWindow.setContentWidth(getResources().getDimensionPixelSize(R.dimen.popup_window_width));
            listPopupWindow.setHorizontalOffset(getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin));
            listPopupWindow.setOnItemClickListener((parent, view, position, id) -> {
                Log.d("Selected", String.valueOf(position));
                prefs.edit().putInt(Common.PREF_LOCATION_UPDATE_INTERVAL,
                        getResources().getIntArray(R.array.location_update_interval_values)[position]).apply();
                listPopupWindow.dismiss();
                updatePreferenceSummaries();
                updateLocationTracker();
            });
            listPopupWindow.show();
            return true;
        case Common.PREF_RESET_HOST_MISMATCHES:
            prefs.edit().remove(Common.PREF_ALLOWED_HOST_MISMATCHES_KEY).apply();
            Toast.makeText(getActivity(), R.string.toast_ignored_ssl_mismatches_cleared, Toast.LENGTH_SHORT).show();
            updatePreferenceSummaries();
            return true;
        case Common.HELP_TRANSLATE:
            CustomTabsSession session = ((SettingsActivity) getActivity()).getCustomTabsSession();
            if (session != null) {
                @SuppressWarnings("deprecation") CustomTabsIntent intent = new CustomTabsIntent.Builder(session)
                        .setShowTitle(true)
                        .enableUrlBarHiding()
                        .setToolbarColor(getResources().getColor(R.color.primary))
                        .build();
                intent.launchUrl(getActivity(), Uri.parse(Common.CROWDIN_URL));
            }
            return true;
        default:
            return super.onPreferenceTreeClick(preference);
    }
}
 
开发者ID:Maxr1998,项目名称:home-assistant-Android,代码行数:42,代码来源:SettingsActivity.java


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