Skip to content

Instantly share code, notes, and snippets.

@makovkastar
Created September 4, 2014 18:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makovkastar/430527f47f7171e8f2c5 to your computer and use it in GitHub Desktop.
Save makovkastar/430527f47f7171e8f2c5 to your computer and use it in GitHub Desktop.
Initally hide the FAB and show it with an animation.
public class MainActivity extends ListActivity {
private Handler mHandler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final FloatingActionButton floatingActionButton = (FloatingActionButton) findViewById(R.id.button_floating_action);
floatingActionButton.attachToListView(getListView());
ListAdapter listAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
getResources().getStringArray(R.array.planets));
getListView().setAdapter(listAdapter);
floatingActionButton.hide(false);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
floatingActionButton.show(true);
}
}, 1000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment