本文整理汇总了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;
}
}