Android 我怎样才能有带虚线边框的透明文本字段?
我希望在文本字段的右侧有一个虚线边框。 我找到了这些链接,但我不能做我想做的事 - - 这里是my activity_fullscreen.xml:Android 我怎样才能有带虚线边框的透明文本字段?,android,Android,我希望在文本字段的右侧有一个虚线边框。 我找到了这些链接,但我不能做我想做的事 - - 这里是my activity_fullscreen.xml: <EditText android:id="@+id/editText1" android:layout_width="278dp" android:layout_height="52dp" android:background="@drawabl
<EditText
android:id="@+id/editText1"
android:layout_width="278dp"
android:layout_height="52dp"
android:background="@drawable/dotted"
android:ems="10"
android:inputType="textShortMessage" />
这里是我的drawable/dotterd.xml:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Border TOP LEFT BOTTOM -->
<item>
<shape>
<!-- Border TOP LEFT BOTTOM color-->
<solid android:color="#fff"/><!-- White-->
<stroke
android:width="5dp"
android:color="#000" /><!-- Black-->
</shape>
</item>
<!-- Border TOP LEFT BOTTOM width -->
<item android:left="2dip"
android:top="2dp"
android:bottom="2dp">
<shape>
<solid android:color="#fff"/> <!-- White-->
<!-- Dotted border RIGHT -->
<stroke android:dashGap="3dp"
android:dashWidth="3dp"
android:width="5dp"
android:color="#ff0000" /><!-- Red-->
</shape>
</item>
<item android:bottom="2dip"
android:top="2dip"
android:left="2dip"
android:right="2dip">
<shape>
<!-- Background Color-->
<solid android:color="#ffafafaf"/><!-- Grey -->
</shape>
</item>
</layer-list>
我得到这个结果:
我想要这个:
不要使用形状,难道你不能只使用9块背景图像吗?好主意,我会试试。但这是一种我想要的塑造方式吗?