如何让EditText和Button有这个彩色边框?

问题描述 投票:0回答:1

如何用这个边框制作

EditText
和用这个边框制作
Button
。我找不到用可绘制的方法来做到这一点。我用
ImageView
来实现这个。但我不能使用
ImageView
来代替
EditText
。怎么才能做到这一点?

android kotlin android-layout android-drawable android-vectordrawable
1个回答
-1
投票

您可以将可绘制对象设置为视图的背景。假设您有用于该边框设计的可绘制对象,或者您可以从这个site生成它。

<TextView 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Text"
    android:background="@drawable/custom_background"/>

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Button Text"
    android:background="@drawable/custom_background"/>
© www.soinside.com 2019 - 2024. All rights reserved.