展会信息港展会大全

如何制作圆形浮动菜单效果
来源:互联网   发布日期:2016-01-14 11:29:48   浏览:4387次  

导读: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_w...

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;

}

赞助本站

人工智能实验室

相关热词: android开发 android教程

AiLab云推荐
推荐内容
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港