Blue.Sky Active Member Licensed User Longtime User Oct 15, 2015 #1 Hi I use statelistdrawable for button I use colordrawable with radius 50 for convert button to circle Now in many device is correct but with different dpi button not circle complete How set radius to button for convert to circle?
Hi I use statelistdrawable for button I use colordrawable with radius 50 for convert button to circle Now in many device is correct but with different dpi button not circle complete How set radius to button for convert to circle?
ilan Expert Licensed User Longtime User Oct 15, 2015 #3 just make sure that the height and width are the same like btn1.height = 10%x (use %) btn1.width = 10%x (use also x for the width to get a square) now set the radius to 5%x (half of the width) you should now get a circle on any device. regards, ilan Upvote 0
just make sure that the height and width are the same like btn1.height = 10%x (use %) btn1.width = 10%x (use also x for the width to get a square) now set the radius to 5%x (half of the width) you should now get a circle on any device. regards, ilan
Blue.Sky Active Member Licensed User Longtime User Oct 15, 2015 #4 MaFu said: Did you use 50 or 50dip? Click to expand... I use 50 not 50dip Upvote 0
Blue.Sky Active Member Licensed User Longtime User Oct 15, 2015 #5 ilan said: just make sure that the height and width are the same like btn1.height = 10%x (use %) btn1.width = 10%x (use also x for the width to get a square) now set the radius to 5%x (half of the width) you should now get a circle on any device. regards, ilan Click to expand... Thank you I define view's size in designer Upvote 0
ilan said: just make sure that the height and width are the same like btn1.height = 10%x (use %) btn1.width = 10%x (use also x for the width to get a square) now set the radius to 5%x (half of the width) you should now get a circle on any device. regards, ilan Click to expand... Thank you I define view's size in designer
ilan Expert Licensed User Longtime User Oct 15, 2015 #6 you can use in designer % then in your code you just set corner radius to btn1.widht /2 Last edited: Oct 16, 2015 Upvote 0
MaFu Well-Known Member Licensed User Longtime User Oct 15, 2015 #7 Blue.Sky said: I use 50 not 50dip Click to expand... You should avoid using normal values for view sizes, in all cases. Use dip and your views have (almost) the same size on all devices. This belongs to code, designer uses dip automatically. Upvote 0
Blue.Sky said: I use 50 not 50dip Click to expand... You should avoid using normal values for view sizes, in all cases. Use dip and your views have (almost) the same size on all devices. This belongs to code, designer uses dip automatically.
Cableguy Expert Licensed User Longtime User Oct 16, 2015 #9 Also to note, any radius bigger than the half of the bigger side(x or y) will render to as if it was set to its half Upvote 0
Also to note, any radius bigger than the half of the bigger side(x or y) will render to as if it was set to its half
Blue.Sky Active Member Licensed User Longtime User Oct 16, 2015 #10 Cableguy said: Also to note, any radius bigger than the half of the bigger side(x or y) will render to as if it was set to its half Click to expand... I adjust to View's width and height (Radius = View1.Width / 2) Upvote 0
Cableguy said: Also to note, any radius bigger than the half of the bigger side(x or y) will render to as if it was set to its half Click to expand... I adjust to View's width and height (Radius = View1.Width / 2)