我在android studio中很难过。 我希望更改宽度以匹配PopupMenu中的文本大小,并使文本居中。
在活动中,PopupMenu使用了:
Context wrapper = new ContextThemeWrapper(PatientListActivity.this, R.style.YOURSTYLE);
PopupMenu popupMenu = new PopupMenu(wrapper, typeView);
popupMenu.getMenuInflater().inflate(R.menu.menu_type, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
我的PopupMenu的菜单项是:
android:title="All"/>
android:title="P"/>
android:title="ET"/>
android:title="ㅡ"/>
我这样指定PopupMenu的样式,但没有任何改变。
wrap_content
center_horizontal
我希望可以更改PopupMenu中的宽度大小,并可以将文本排列在中间。