本文整理匯總了Java中android.widget.ListPopupWindow.setVerticalOffset方法的典型用法代碼示例。如果您正苦於以下問題:Java ListPopupWindow.setVerticalOffset方法的具體用法?Java ListPopupWindow.setVerticalOffset怎麽用?Java ListPopupWindow.setVerticalOffset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.ListPopupWindow
的用法示例。
在下文中一共展示了ListPopupWindow.setVerticalOffset方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
示例2: 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);
}
示例3: 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);
}
示例4: 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));
}
示例5: 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;
}
}