It can pop a horizontal popup menu when you press a View by a long-press guesture.
长按ListView, GridView 或普通View, 弹出横向气泡式菜单。
This utility class can bind a horizontal popup-menu for ListView, GridView, or other View easily.
该工具类可以很方便的为ListView, GridView, 甚至普通View绑定长按弹出横向气泡式菜单。
Welcome star, fork
欢迎右上角star,fork
##效果图(Screenshot)
##使用方式(How do I use PopupList?)
Just need a
.java
file and a little code.
只需要一个Java文件和几行代码即可。
PopupList popupList = new PopupList();
popupList.init(context, view, popupMenuItemList, OnPopupListClickListener);
##例子(Sample):
lv_main = (ListView) findViewById(R.id.lv_main);
mDataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, mDataList);
lv_main.setAdapter(mDataAdapter);
popupMenuItemList.add(getString(R.string.copy));
popupMenuItemList.add(getString(R.string.delete));
popupMenuItemList.add(getString(R.string.share));
popupMenuItemList.add(getString(R.string.more));
PopupList popupList = new PopupList();
popupList.init(this, lv_main, popupMenuItemList, new PopupList.OnPopupListClickListener() {
@Override
public void onPopupListClick(View contextView, int contextPosition, int position) {
Toast.makeText(MainActivity.this, contextPosition + "," + position, Toast.LENGTH_LONG).show();
}
});
popupList.setIndicatorView(popupList.getDefaultIndicatorView(dp2px(16), dp2px(8), 0xFF444444));
##配置(Configuration):
You can get more information from the Wiki page.
可以在Wiki页了解更多