Android: How to create a custom editing text box like this?

I am trying to create this form in Android

enter image description here

  • You see that EditText has several shadows in front. How to create it?
  • I created autocomplete text views for state and place. But how can I add this line and arrow?
+5
source share
1 answer

You can set the background suitable for achievement. Create a custom drawing method using the form or use a background image and put it in the Android xml layout: background = "@ hood / text_bg"

create the file "testing_gradient.xml" 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 code in xml file layout

  <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 layers to enter more images enter image description here

+11
source

Source: https://habr.com/ru/post/1207934/


All Articles