Back to project page android-floating-action-button.
The source code is released under:
Apache License
If you think the Android project android-floating-action-button listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package in.sahidave.floatingactiobutton.sample; //from w w w. j a v a 2 s .com import in.sahildave.floatingactionbutton.FloatingActionButton; import in.sahildave.floatingactionbutton.FloatingActionsMenu; import in.sahildave.floatingactionbutton.sample.R; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.pink_icon).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this, "Clicked pink Floating Action Button", Toast.LENGTH_SHORT).show(); } }); FloatingActionButton button = (FloatingActionButton) findViewById(R.id.setter); button.setSize(FloatingActionButton.SIZE_MINI); button.setColorNormalResId(R.color.pink); button.setColorPressedResId(R.color.pink_pressed); button.setIcon(R.drawable.ic_fab_star); FloatingActionButton actionC = new FloatingActionButton(getBaseContext()); ((FloatingActionsMenu) findViewById(R.id.multiple_actions)).addButton(actionC); final FloatingActionButton actionA = (FloatingActionButton) findViewById(R.id.action_a); actionA.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { actionA.setTitle("Action A clicked"); } }); } }