我摆脱了操作栏上的图标和标签,并有3个按钮导航到应用程序的某些部分。问题是按钮都被压扁到动作栏的一侧!我怎么把它隔开?我很乐意在动作栏左侧有一个,中间一个,右边一个。让我的用户看起来更干净整洁:)
答案 0 :(得分:0)
做以下事情,
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_activity_actions, menu);
// ...
// Find the icon(Button); make it aligned to right or left or center, also in expanded mode:
<"your bttn">.setLayoutParams(new ActionBar.LayoutParams(Gravity.RIGHT));
<"your bttn2">.setLayoutParams(new ActionBar.LayoutParams(Gravity.LEFT));
<"your bttn3">.setLayoutParams(new ActionBar.LayoutParams(Gravity.CENTER));
}