如何删除edittextfield android的边界 [英] How to remove the border of edittextfield in android

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

问题描述

我如何删除EDITTEXT场的边界机器人。其实它看起来像这样

How can I remove the border of a Edittext field in android. Actually it looks like this

http://pbrd.co/V34sN7

通过这种布局code

With this layout code

    <EditText
        android:id="@+id/login_error"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text=""
        android:background="@android:drawable/editbox_background_normal"
        android:visibility="invisible" 
        android:textColor="#FF0000"
        android:layout_gravity="right"
        />

另外,文本的对齐方式是不是在右侧,虽然我定义它。

Also the alignment of the text is not on the right side although I defined it.

感谢

推荐答案

您可以通过下面的XML布局自定义编辑文本

You can customise your edit text by using the following xml layout

将下面的code为 yourWishName.xml

<?xml version="1.0" encoding="UTF-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">

//You can change the color of the edit text here which removes the border line as well
 <item android:state_focused="true" >
    <shape android:shape="rectangle">
        <gradient
            android:startColor="#FFFFFF"
            android:endColor="#FFFFFF"
            android:angle="270" />
        <stroke
            android:width="3dp"
            android:color="#F8B334" />
        <corners
            android:radius="12dp" /> 
    </shape>
</item>  
<item>
    <shape android:shape="rectangle">
        <gradient
            android:startColor="#FFFFFF"
            android:endColor="#FFFFFF"
            android:angle="270" />
        <stroke
            android:width="0dp"
            android:color="#000000" />
        <corners
            android:radius="12dp" /> 
    </shape>
</item>
</selector>

在EditText上调用XML 安卓背景=@可绘制/ yourWishName

In EditText call the xml android:background="@drawable/yourWishName"

要正确对齐使用安卓重力=正确的

希望这有助于

这篇关于如何删除edittextfield android的边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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