这个是popupwindow的内容xml(就是放了个ListView):
展现popupwindow的时候,
public MenuPopup(final Context context) { **super(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);** View contentView = LayoutInflater.from(context).inflate(resId, null); ListView lv = (ListView) contentView .findViewById(R.id.lv_ppw_settings_lists); String[] menuItems = context.getResources().getStringArray(R.array.associator_query_menu); PopupSettingsAdapter adapter = new PopupSettingsAdapter(context, menuItems); .... }
我都用了wrap_content了
然而结果却是:
醉了,这是什么缘故。。。
可能是ListView 的item的布局问题吧
。。用popupMenu吧。。那才是你想要的效果,并且比你这个简单美观多了
因为wrap_content对ListView是不起效的,没有明确的width hight,默认都是会撑满。