首页 > 解决方案 > 如何使用像 Sticker View Corner 这样的 XML 绘制一个带有圆端圆角的矩形

问题描述

如何为像有的矩形边缘创建圆形StickerView。我不想用StickerView,因为它不支持EditTextlike功能。

xml的矩形代码。我想添加带有圆形大圆点的角。

  <?xml version="1.0" encoding="utf-8"?>
    <!--  res/drawable/rounded_edittext.xml -->
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle" android:padding="10dp">

        <corners

            android:bottomRightRadius="15dp"
            android:bottomLeftRadius="15dp"
            android:topLeftRadius="15dp"
            android:topRightRadius="15dp"/>

    </shape>

下面是mainactivity.xml我实现边框的代码 RotatableAutofitEditText

 <com.agilie.RotatableAutofitEditText xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:autofit="http://schemas.android.com/apk/res-auto"
            android:id="@+id/editText"
            android:layout_width="wrap_content"


            android:layout_height="wrap_content"
            android:layout_marginStart="128dp"


            android:layout_marginTop="272dp"
            android:background="@drawable/borders"
            android:gravity="center"
            android:hint="@string/hint_add_some_text"
            android:text="Type Here"

            android:textColor="@android:color/white"

            android:textColorHint="@android:color/darker_gray"
            autofit:clipBounds="false"
            autofit:layout_constraintStart_toStartOf="parent"
            autofit:layout_constraintTop_toTopOf="parent"
            autofit:maxTextSize="@dimen/autoresize_max_text_size"
            autofit:minTextSize="@dimen/autoresize_min_text_size"
            autofit:minWidth="@dimen/autoresize_min_width"
            autofit:movable="true"
            autofit:resizable="true"
            autofit:rotatable="true" />

标签: androidxml

解决方案



推荐阅读