當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。