Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: How to create a customized edit text box like this?

I'm trying to create to make this form in Android

enter image description here

  1. You see the EditText has some shadows at the front. How do I create that?
  2. I created AutoComplete Text Views for State and Place. But how to I add that line and arrow on it?
like image 430
George Avatar asked Nov 29 '14 14:11

George


1 Answers

You can set background drawable to achieve.either create custom drawable with shape or use background images and put it in the layout xml android:background="@drawable/text_bg"

create an "testing_gradient.xml" file in /res/drawable

<?xml version="1.0" encoding="utf-8"?>

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

  <item android:drawable="@color/grey">
    <shape
      android:shape="rectangle"
      android:thickness="10dp"></shape>
  </item>

  <item
    android:drawable="@color/white"
    android:left="50dp">
    <shape android:shape="rectangle"></shape>
  </item>

</layer-list>

apply the code in layout xml file

  <EditText
  android:background="@drawable/testing_gradient"
  android:layout_width="match_parent"
  android:textColor="@color/black"
  android:text="User input"
  android:paddingLeft="60dp"
  android:layout_height="60dp"/>

final result

enter image description here

Again, you can add more layer to input more images enter image description here

like image 155
Dave Wong Avatar answered Oct 21 '22 07:10

Dave Wong