本文整理汇总了Java中android.widget.ListPopupWindow.setBackgroundDrawable方法的典型用法代码示例。如果您正苦于以下问题:Java ListPopupWindow.setBackgroundDrawable方法的具体用法?Java ListPopupWindow.setBackgroundDrawable怎么用?Java ListPopupWindow.setBackgroundDrawable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ListPopupWindow
的用法示例。
在下文中一共展示了ListPopupWindow.setBackgroundDrawable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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);//滑动到顶部
}
});
}
示例3: createPopupFolderList
import android.widget.ListPopupWindow; //导入方法依赖的package包/类
private void createPopupFolderList(int width, int height) {
folderPopupWindow = new ListPopupWindow(getActivity());
folderPopupWindow.setBackgroundDrawable(null);
folderPopupWindow.setAdapter(folderAdapter);
folderPopupWindow.setContentWidth(width);
folderPopupWindow.setWidth(width);
folderPopupWindow.setHeight(height * 5 / 8);
folderPopupWindow.setAnchorView(popupAnchorView);
folderPopupWindow.setModal(true);
folderPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
folderAdapter.setSelectIndex(i);
final int index = i;
final AdapterView v = adapterView;
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
folderPopupWindow.dismiss();
if (index == 0) {
getActivity().getSupportLoaderManager().restartLoader(LOADER_ALL, null, mLoaderCallback);
category_button.setText(R.string.all_folder);
callback.onChangeAlbum(context.getResources().getString(R.string.all_folder));
if (imageConfig.isShowCamera()) {
imageAdapter.setShowCamera(true);
} else {
imageAdapter.setShowCamera(false);
}
}
else {
Folder folder = (Folder) v.getAdapter().getItem(index);
if (null != folder) {
imageList.clear();
imageList.addAll(folder.images);
imageAdapter.notifyDataSetChanged();
category_button.setText(folder.name);
callback.onChangeAlbum(folder.name);
if (resultList != null && resultList.size() > 0) {
imageAdapter.setDefaultSelected(resultList);
}
}
imageAdapter.setShowCamera(false);
}
grid_image.smoothScrollToPosition(0);
}
}, 100);
}
});
}