dependencies {
compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_menu_with_custom_action_button, container, false);
Button centerActionButton = (Button) rootView.findViewById(R.id.centerActionButton);
// menu文字
TextView a = new TextView(getActivity()); a.setText("a"); a.setBackgroundResource(android.R.drawable.btn_default_small);
TextView b = new TextView(getActivity()); b.setText("b"); b.setBackgroundResource(android.R.drawable.btn_default_small);
TextView c = new TextView(getActivity()); c.setText("c"); c.setBackgroundResource(android.R.drawable.btn_default_small);
TextView d = new TextView(getActivity()); d.setText("d"); d.setBackgroundResource(android.R.drawable.btn_default_small);
TextView e = new TextView(getActivity()); e.setText("e"); e.setBackgroundResource(android.R.drawable.btn_default_small);
TextView f = new TextView(getActivity()); f.setText("f"); f.setBackgroundResource(android.R.drawable.btn_default_small);
TextView g = new TextView(getActivity()); g.setText("g"); g.setBackgroundResource(android.R.drawable.btn_default_small);
TextView h = new TextView(getActivity()); h.setText("h"); h.setBackgroundResource(android.R.drawable.btn_default_small);
FrameLayout.LayoutParams tvParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
a.setLayoutParams(tvParams);
b.setLayoutParams(tvParams);
c.setLayoutParams(tvParams);
d.setLayoutParams(tvParams);
e.setLayoutParams(tvParams);
f.setLayoutParams(tvParams);
g.setLayoutParams(tvParams);
h.setLayoutParams(tvParams);
//menu的创造器
SubActionButton.Builder subBuilder = new SubActionButton.Builder(getActivity());
//构造过程
FloatingActionMenu circleMenu = new FloatingActionMenu.Builder(getActivity())
.setStartAngle(0) // A whole circle!
.setEndAngle(360)
.setRadius(getResources().getDimensionPixelSize(R.dimen.radius_large))
.addSubActionView(a)
.addSubActionView(b)
.addSubActionView(c)
.addSubActionView(d)
.addSubActionView(e)
.addSubActionView(f)
.addSubActionView(g)
.addSubActionView(h)
.attachTo(centerActionButton)
.build();
return rootView;
}