如何拥有的EditText在Android的边界棒棒糖 [英] How to have EditText with border in Android Lollipop

查看:160
本文介绍了如何拥有的EditText在Android的边界棒棒糖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Android应用程序。我需要知道我们如何能有一个边界的EditText。在棒棒糖他们已经完全改变了风格的EditText。我们能做到这一点,而不使用绘图资源?

I am developing an Android app. I need to know how we can have a EditText with border. In Lolipop they have completely changed the EditText style. Can we do it without using drawables?

推荐答案

写在资源文件夹绘制绘制XML

write drawable xml in drawable folder in resources

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <stroke
        android:width="1dp"
        android:color="@color/borderColor" />
</shape>

不要忘了在一个名为资源申报色 BORDERCOLOR

和分配此背景,以XML格式的EditText 背景属性。

and assign this background to the EditText in xml background attribute

<EditText
    android:id="@+id/text"
    android:background:"@drawable/editTextBackground"
    />

和它会设置边框的EditText

这篇关于如何拥有的EditText在Android的边界棒棒糖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆