gwtbootstrap3。如何用按钮调整 ButtonGroup 元素

gwtbootstrap3. How to justified ButtonGroup element with buttons

我想将我的按钮组调整为父级的整个宽度。

我正在尝试 Justified button groups

这是我的代码:

ButtonGroup buttonGroupHelper = new ButtonGroup();

Button loginButton = new Button("Log in");
Button resetButton = new Button("Reset");
Button forgotCredentialsButton = new Button("Forgot credentials?");

buttonGroupHelper.add(loginButton);
buttonGroupHelper.add(resetButton);
buttonGroupHelper.add(forgotCredentialsButton);

我得到这个:

我什么时候添加这一行:

buttonGroupHelper.setJustified(true);

我得到这个:

我用bootstrap css darkly theme.

这是我的 gwtbootstrap3 框架生成的html:

<div class="btn-group btn-group-justified">
    <button type="button" class="btn btn-success"><i class="fa fa-play-circle-o"></i> Log in</button>
    <button type="button" class="btn btn-danger"><i class="fa fa-times-circle-o"></i> Reset</button>
    <button type="button" class="btn btn-warning"><i class="fa fa-key"></i> Forgot credentials?</button>
</div>

我是不是做错了什么。或者这只是一个错误?

请帮忙。

您应该将按钮放在按钮组中,然后将按钮组放在辅助按钮组中。

ButtonGroup buttonGroupHelper = new ButtonGroup();
ButtonGroup loginBtnGroup = new ButtonGroup();
ButtonGroup resetBtnGroup = new ButtonGroup();
ButtonGroup forgotBtnGroup = new ButtonGroup();

Button loginButton = new Button("Log in");
Button resetButton = new Button("Reset");
Button forgotCredentialsButton = new Button("Forgot credentials?");

loginBtnGroup.add(loginButton);
resetBtnGroup.add(resetButton);
forgotBtnGroup.add(forgotCredentialsButton);

buttonGroupHelper.add(loginBtnGroup);
buttonGroupHelper.add(resetBtnGroup);
buttonGroupHelper.add(forgotBtnGroup);

buttonGroupHelper.setJustified(true);