how can I achieve this with the editText?

1

I would like to know how to achieve this with a editText I can not find the form, I can not find information for someone to enlighten me pls

    
asked by Jesus Rodriguez 04.09.2017 в 07:51
source

3 answers

1

You can do the following:

<RelativeLayout
    android:layout_width="100dp"
    android:layout_height="30dp"
    android:background="@drawable/fondo_degradado"
    android:padding="5dp">

    <EditText 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        android:background="@android:color/transparent"
    />

</RelativeLayout>

You can not directly apply XML shapes since you will not have the degraded effect that you want for the edge, so you must have a PNG image within drawable that is your background and thus apply the effect you want.

    
answered by 04.09.2017 / 18:39
source
1

EditText with rounded edges.

Similar to other views as a Boton or TextView , like this example:

Rounded Android buttons

in the case of a EditText , you can use a ShapeDrawable (shape) :

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> 
    <solid android:color="#ffffff"/>    

    <stroke android:width="3dp"
            android:color="#ff000000"/>

    <padding android:left="1dp"
             android:top="1dp"
             android:right="1dp"
             android:bottom="1dp"/> 

    <corners android:radius="30px"/> 
</shape>

Which you would assign to your EditText,

<EditText
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:hint="User Name"
    android:padding="5dp"
    android:background="@drawable/borde_redondo"/>

to obtain as a result:

    
answered by 04.09.2017 в 18:21
0

You need to make an XML configuration file, where you add all the properties that your editText will have, and then when you editText you apply that design to the background property.

On this website they give you a simple example to make an editText have the round edges

This is an example of XML to put the round edges, you just have to put color to the edges.

<?xml version="1.0" encoding="utf-8"?>
<!-- res/drawable/rounded_edittext.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="10dp"
android:shape="rectangle">

<solid android:color="#F8F8F8"/>

<corners
    android:bottomLeftRadius="4dp"
    android:bottomRightRadius="4dp"
    android:topLeftRadius="4dp"
    android:topRightRadius="4dp"/>

</shape>

I hope it helps you

    
answered by 04.09.2017 в 13:44