每当我单击浮动操作按钮时,会出现另外两个浮动操作按钮,一个用于打开相机,另一个用于上传图片,问题是当我选择子操作按钮并转到下一个活动时,一切正常,但是当我返回浮动操作按钮的主页时,两个子按钮仍在主浮动按钮之外
我必须重新打开应用程序才能修复它,
这是我的代码
private void setupFloatingActionMenu(Context context) {
ImageView imgv = new ImageView(context); // Create an icon
imgv.setImageResource(R.drawable.ic_launcher);
FloatingActionButton actionButton = new FloatingActionButton.Builder((Activity) context)
.setContentView(imgv)
.build();
ImageView capture = new ImageView(context);
capture.setImageResource(R.drawable.ic_launcher);
ImageView upload = new ImageView(context);
upload.setImageResource(R.drawable.ic_launcher);
SubActionButton.Builder itemBuilder = new SubActionButton.Builder((Activity) context);
SubActionButton buttonSortCap = itemBuilder.setContentView(capture).build();
SubActionButton buttonSortUpd = itemBuilder.setContentView(upload).build();
FloatingActionMenu actionMenu = new FloatingActionMenu.Builder((Activity) context)
.addSubActionView(buttonSortCap)
.addSubActionView(buttonSortUpd)
.setRadius(150)
.enableAnimations()
.attachTo(imgv)
.build();
buttonSortCap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
captureImage();
}
});
buttonSortUpd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, ""), PICK_IMAGE);
}
});
}