use*_*534 1 xml android android-layout android-button
我有两个按钮,我想将它们的形状更改为半圆形。然后将它们并排放置成一个完整的圆圈。已附加图像以显示我想要的按钮外观。任何帮助将不胜感激。谢谢。

您必须创建一个可绘制的 xml 文件。
left_corner.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="1dp"
android:bottomRightRadius="0dp" android:bottomLeftRadius="25dp"
android:topLeftRadius="25dp" android:topRightRadius="0dp"/> // here you have to put dimen as per reqiurement
<solid android:color="@color/green" />
</shape>
Run Code Online (Sandbox Code Playgroud)
right_corner.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="1dp"
android:bottomRightRadius="25dp" android:bottomLeftRadius="0dp"
android:topLeftRadius="0dp" android:topRightRadius="25dp"/> // here you have to put dimen as per reqiurement
<solid android:color="@color/green" />
</shape>
Run Code Online (Sandbox Code Playgroud)
布局.xml
<Linearlayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button android:layout_width="@dimen/_150sdp"
android:layout_height="@dimen/_150sdp"
android:background="@draable/left_corner"/>
<Button android:layout_width="@dimen/_150sdp"
android:layout_height="@dimen/_150sdp"
android:background="@draable/right_corner"/>
</Linearlayout>
Run Code Online (Sandbox Code Playgroud)
这对我来说是工作..
| 归档时间: |
|
| 查看次数: |
8586 次 |
| 最近记录: |