Android – the round button becomes distorted with the length of the text inside
•
Android
I want a perfect round button
I try to use the following code to use shapes. But the problem I face is that when there are two text in the view, it looks almost a circle, but as long as there are one and three characters in the view, it will look oval
Shape code
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="true">
<corners android:bottomRighTradius="20dip"
android:bottomLefTradius="20dip"
android:topRighTradius="20dip"
android:topLefTradius="20dip"
/>
</shape>
Please check the almost circular buttons, which are marked with numbers 2 and 22. I used the same code for all buttons (as described above)
resolvent:
In the layout file (or code), keep the size of the button fixed (width = height = some DP). For example:
layout_width="48dp"
layout_height="48dp"
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码