Please tell me how to round off the edges of a button or some other object.
1 answer
Write in the drawable
folder such xml
:
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#0ff"/> //цвет по вкусу <size android:width="100dp" android:height="100dp"/> //размер по вкусу <!--Так (каждый угол по отдельности)--> <corners android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" android:topLeftRadius="20dp" android:topRightRadius="20dp"/> <!--Или так (все углы за раз)--> <corners android:radius="10dp"/> </shape>
and assign the android:background="@drawable/my_back"
attribute to the desired object android:background="@drawable/my_back"
In the case of a button (and many other views) with a custom back, it is better to set a margin
so that the elements do not crawl onto each other
- what does it mean so a corner separately and or so all angles at a time - danchik202020 6:39 pm
- I'm just a beginner - danchik202020
- If you want to make all the corners with the same rounding, use the second option. If you want to make different radii or shapes (such as "droplet" or "shield") - make the first option, adjusting each angle separately. Unselected option, respectively, from the
xml
remove. - Jarvis_J 6:42 pm
|