Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FABView.ui.xml with java code example #17

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,41 @@
&lt;/m:MaterialFAB><br/>
</demo:PrettyPre>


<m:MaterialTitle title="FAB Java code example"/>

<demo:PrettyPre addStyleNames="lang-xml z-depth-1">
public class Fab extends Composite {
public Fab() {
MaterialFAB fab = new MaterialFAB();
// initial button to be initially displayed
MaterialButton btnInitial = new MaterialButton();
btnInitial.setIconType(IconType.ADD);
btnInitial.setType(ButtonType.FLOATING);
btnInitial.setSize(ButtonSize.LARGE);
btnInitial.setBackgroundColor("red");
fab.add(btnInitial);
// Fab list will hide all buttons attached on it
MaterialFABList fabList = new MaterialFABList();
// Item 1
MaterialButton btnItem1 = new MaterialButton();
btnItem1.setType(ButtonType.FLOATING);
btnItem1.setIconType(IconType.ACCESS_ALARMS);
btnItem1.setBackgroundColor("blue");
fabList.add(btnItem1);
// Item 2
MaterialButton btnItem2 = new MaterialButton();
btnItem2.setType(ButtonType.FLOATING);
btnItem2.setIconType(IconType.AC_UNIT);
btnItem2.setBackgroundColor("purple");
fabList.add(btnItem2);
fab.add(fabList);

initWidget(fab);
}
</demo:PrettyPre>
And then in Your view use just:
`widget.add(new Fab());`

</g:HTMLPanel>
</ui:UiBinder>