android - 如何在android中更改自定义形状的边界颜色?

标签 android xml android-edittext

我正在创建一个带圆角的编辑文本,为此我使用自定义形状并将其分配给编辑文本。 我想: 1- 编辑文本的填充区域为白色。 2- 编辑文本的边界应该是绿色的。 第一个要求已满足,但我无法执行第二个要求。这是如何实现的?任何帮助将不胜感激 这是我的代码 编辑文本代码:

<EditText
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:hint="E-mailadres"
        android:background="@drawable/rounded_layout"
        android:layout_marginTop="8dp"
        android:layout_weight="2"/>

自定义布局:

   <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" android:padding="10dp"
    >
    <solid android:color="#FFFFFF"/>
    <corners
        android:bottomRightRadius="10dp"
        android:bottomLeftRadius="10dp"
        android:topLeftRadius="10dp"
        android:topRightRadius="10dp"
        />
    <stroke android:width="1dip"  />
</shape>

所需输出的图像: enter image description here

最佳答案

你好试试下面的代码替换你的笔划

<stroke android:width="1dip"
        android:color="**your color goes here**"/>

关于android - 如何在android中更改自定义形状的边界颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41436784/

相关文章:

java - 如何更改 EditText 的底线颜色?

android - HttpURLConnection setConnectTimeout 不工作

android - 上传图片和其他参数到服务器

asp.net - 何时在XmlDocument或XmlTextReader上使用XPath?

android - 自定义 EditText - Material 设计

android - 如何清除 Android 中的数字 editText?

java - 计步器读数异常

android - java.lang.IllegalArgumentException : Service Intent must be explicit: Intent

ruby-on-rails - 我应该如何(智能地)存储和归档大型 xml 文件以进行数据导入

python - 是否有任何在设计时考虑到人类的 Python XML 解析器?