Android Question Is possible to make a button with different corner radius?

asales

Expert
Licensed User
Longtime User
I see this code of @klaus that make a panel with diferent corner radius:
https://www.b4x.com/android/forum/t...th-different-corner-radius.51475/#post-322392

and this code of @Erel that make a label:
https://www.b4x.com/android/forum/t...us-curves-on-one-side-only.35070/#post-205487

Is possible to make a button with different corner radius?

I try this codes but I get this error in Button view:
B4X:
java.lang.RuntimeException: Method: setCornerRadii not found in: android.graphics.drawable.StateListDrawable
 

asales

Expert
Licensed User
Longtime User
I test both codes in Android 4.4 and 7.0.
It works fine to labels and panels, but not to buttons.

In Android 4.4 I get this error:
B4X:
java.lang.RuntimeException: Method: setCornerRadii not found in: android.graphics.drawable.StateListDrawable
and in Android 7.0 I get this error:
B4X:
java.lang.RuntimeException: Method: setCornerRadii not found in: android.graphics.drawable.RippleDrawable
 
Upvote 0

nibbo

Active Member
Licensed User
Longtime User
Hi, sorry to resurrect this old thread but I think it best if the answer was in this thread.

Yes. You need to create a StateListDrawable and set the corners radius of each of the drawables that are inside the StateListDrawable.

Could someone clarify how this is done?
Please note that this is to be applied to labels which are generated at run time not created in the designer.
Thanks
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

nibbo

Active Member
Licensed User
Longtime User
You should start a new thread for your Question. Always

Not sure that I agree; others will probably find this thread also and then also be required to start another thread if the answer is not found here would they not?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
https://www.b4x.com/android/forum/threads/forum-guidelines.55632/

Tips:
  • Post in the correct sub-forum.
  • Use
    B4X:
    code here...
    tags when posting code.
  • All questions should be open to all members.
  • Start a new thread for your question instead of posting in an existing thread.
  • Use the Like button as a gratitude for other members who try to help you.
  • The thread title should summarize the question.
  • Use the search tool.
 
Upvote 0

nibbo

Active Member
Licensed User
Longtime User
OK, will do, thanks for the tip, I probably should read the guidelines when I get time...
 
Upvote 0
Top