比如
public boolean onCreateOptionsMenu(Menu menu){
super.onCreateOptionsMenu(menu);
menu.add("1");
menu.add( "2");
menu.add( "3");
menu.add("4");
menu.add("5");
menu.add("6");
return true;
}
默认是 1 2 3
4 5 6 这样排列我要实现从左到右1 2 3 4 5 6一行排列,可行吗?
public boolean onCreateOptionsMenu(Menu menu){
super.onCreateOptionsMenu(menu);
menu.add("1");
menu.add( "2");
menu.add( "3");
menu.add("4");
menu.add("5");
menu.add("6");
return true;
}
默认是 1 2 3
4 5 6 这样排列我要实现从左到右1 2 3 4 5 6一行排列,可行吗?
public IconMenuView(Context context, AttributeSet attrs) {
super(context, attrs); TypedArray a =
context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.IconMenuView, 0, 0);
mRowHeight = a.getDimensionPixelSize(com.android.internal.R.styleable.IconMenuView_rowHeight, 64);
mMaxRows = a.getInt(com.android.internal.R.styleable.IconMenuView_maxRows, 2);
mMaxItems = a.getInt(com.android.internal.R.styleable.IconMenuView_maxItems, 6);
mMaxItemsPerRow = a.getInt(com.android.internal.R.styleable.IconMenuView_maxItemsPerRow, 3);
....
}
这IconMenuView的构造函数里,这些致已经被写死了。如果你要放在一行显示,仅仅改这些值是不够的,需要重新调整layout