Android 圆形方形背景形状,右上角有切圆
我需要创建具有如下设计的项目列表 背景多为右上角圆形雕刻,便于图标排列。 试试这个Android 圆形方形背景形状,右上角有切圆,android,android-layout,Android,Android Layout,我需要创建具有如下设计的项目列表 背景多为右上角圆形雕刻,便于图标排列。 试试这个 <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.co
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/white">
<RelativeLayout
android:id="@+id/view"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@drawable/roundcorner"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<RelativeLayout
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/round"
app:layout_constraintBottom_toTopOf="@+id/view"
app:layout_constraintEnd_toEndOf="@+id/view"
app:layout_constraintStart_toEndOf="@+id/view"
app:layout_constraintTop_toTopOf="@+id/view" />
</androidx.constraintlayout.widget.ConstraintLayout>
round.xml
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#c20586"/>
<stroke android:width="5dp"
android:color="@android:color/white"/>
</shape>
roundcorner.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffa800" />
<corners android:radius="10dp" />
</shape>
我希望有帮助。你可以试试这样的东西 输出: 布局:
根据您的要求调整宽度和高度问题/问题到底是什么?您无法创建该可绘制图形,即使可以,也很难创建。您可以采用完全圆形的橙色背景,然后采用圆形背景,并将时钟置于橙色背景之上
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="120dp"
android:layout_height="150dp">
<View
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:background="@drawable/rounded_yellow_radius_10" />
<RelativeLayout
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:background="@drawable/circle_white">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/white_circles"
android:padding="5dp"
android:src="@drawable/circle_pink" />
</RelativeLayout>
</RelativeLayout>