I am working on a project that has 5 buttons when I click on any of them it should show another 3 buttons. When I click on any of the 3 buttons it should open an activity.
I have tried working with MaterialArcMenu it doesn't give me what I need it gave me a circle button .
Can I receive any advice on this?
Button 1 ---> Nested Button 1 --> Nested Button 1
---> Nested Button 2
Button 2
Button 3
Button 4
Button 5
If you are creating the button from a layout, then what I would suggest to do is add the activity or fragment as the click event listener. Secondly, set a tag for the button. Then when the button is clicked, get the tag for the view and handle accordingly.
Here is an example:
protected CustomImageButton getSmartLinkImageButton(int buttonImageResource, int colorToChangeTo, boolean isLargerImage, ActionType buttonAction) {
LayoutInflater inflater = (LayoutInflater) this.getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
SmartLinkImageButton button = (SmartLinkImageButton) inflater.inflate(R.layout.footer_smartlink_image_button, null);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(mFooterButtonWidth,
isLargerImage == true ? mFooterButtonHeight / 2 : mFooterButtonHeight);
params.gravity = Gravity.CENTER;
button.setLayoutParams(params);
if(isLargerImage)
button.setScaleType(ScaleType.FIT_CENTER);
button.setImageResource(buttonImageResource);
if(colorToChangeTo > 0) {
changeImageViewImageColor(button, null, colorToChangeTo);
button.setDefaultColorFilter(colorToChangeTo);
}
button.setTag(buttonAction); //HERE IS THE TAG CREATION
button.setOnClickListener(this);
//optional method for mapping image buttons
mapImageButton(button, buttonAction);
inflater = null;
return button;
}
Then the onClick:
@Override
public void onClick(View view) {
view.getTag(); //DO ACTION BASED ON VIEWS TAG
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.