TextInputLayout endIcon background color - android

Is it possible to have background color only behind endIcon?
At the moment all I can do is only showing the custom icon.
Here the code I write to get current design.
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/date_of_birth_input_layout"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
app:endIconDrawable="#drawable/ic_calendar"
app:endIconMode="custom"
app:endIconTint="#color/redText"
app:endIconTintMode="multiply"
app:hintEnabled="false"
app:layout_constraintTop_toBottomOf="#id/date_of_birth_title">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/date_of_birth_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/activity_horizontal_margin"
android:layout_marginTop="6dp"
android:layout_marginEnd="#dimen/activity_horizontal_margin"
android:focusable="false"
android:fontFamily="#font/opensans_regular"
android:hint="#string/date_of_birth_hint"
android:imeOptions="actionNext"
android:inputType="text"
android:paddingLeft="10dp"
android:paddingTop="13dp"
android:paddingRight="10dp"
android:paddingBottom="13dp"
android:textSize="16sp" />
</com.google.android.material.textfield.TextInputLayout>

Add new calendar.xml to drawable
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="1.5dp"
android:top="1.5dp"
android:right="1.5dp"
android:drawable="#drawable/background"
android:gravity="center_horizontal|center_vertical"
android:width="48dp"
android:height="48dp"
/>
<item
android:drawable="#drawable/ic_calendar"
android:gravity="center_horizontal|center_vertical"
android:width="36dp"
android:height="36dp"
/>
</layer-list>
backgroud.xml like this:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="#color/red" />
<corners android:bottomRightRadius="2.5dp"
android:topRightRadius="2.5dp"/>
</shape>
and change like this:
app:endIconDrawable="#drawable/calendar"
if you get an error(vector) you should add this to build.gradle:
defaultConfig {
vectorDrawables.useSupportLibrary = true
}

Related

Why custom drawable not showing in android

TextView is added to the screen
<TextView
android:id="#+id/eventDetail_SpecialInfos"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:fontFamily="#font/source_sans_pro"
android:text="Special Info"
android:drawableBottom="#drawable/information_underline"
android:textColor="#color/colorBlack"
android:textSize="14dp" />
information_underline drawable is :
<stroke
android:width="20dp"
android:color="#color/colorBlack" />
Check the #Suraj answer.
An alternative could be to use a TextInputLayout in the Material Component Library with a OutlinedBox style.
Something like:
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
..>
<com.google.android.material.textfield.TextInputEditText
../>
</com.google.android.material.textfield.TextInputLayout>
Drawable you have created is not the right way to do that and use the below code to draw anything in bottom of textview
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<size
android:height="1dp"
android:width="100dp" />
<solid android:color="#android:color/black" />
</shape>

Inside the spinner how to set imageview at the right corner

<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Spinner
android:id="#+id/spinner1_day"
android:layout_width="70dp"
android:layout_height="40dp"
android:src="#drawable/edit_text_style"
android:text="Day"
android:textStyle="normal"
android:textSize="15dp"
android:fontFamily="sans-serif-light"
android:drawSelectorOnTop="true"
android:entries="#array/Day"
android:dropDownWidth="fill_parent"
android:background="#drawable/downimage"/>
<Spinner
android:id="#+id/spinner2_month"
android:layout_width="70dp"
android:layout_height="40dp"
android:background="#drawable/edit_text_style"
android:text="Day"
android:textStyle="normal"
android:textSize="15dp"
android:fontFamily="sans-serif-light"
android:drawSelectorOnTop="true"
android:entries="#array/Day"
android:layout_gravity="center_horizontal"
android:layout_weight="0.81"
android:layout_marginLeft="10dp"
/>
</LinearLayout>
i used android:dropDownWidth="fill_parent" and android:background="#drawable/downimage" but the image will be set as background.how can is set imageview inside the spinner at the right corner?
<LinearLayout
android:id="#+id/layoutSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/input_field"
android:orientation="horizontal"
android:padding="5sp">
<Spinner
android:id="#+id/spinner_area"
android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="9"
android:background="#null"
android:entries="#array/state"
android:gravity="center"
android:prompt="#string/area_prompt"
android:spinnerMode="dropdown" />
<ImageView
android:id="#+id/errow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:padding="5sp"
android:src="#drawable/arrow1" />
</LinearLayout>
Use this
Create an XML in drawable folder with any name for example spinner_bg.xml and add the following lines
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item><layer-list>
<item><shape>
<gradient android:angle="90" android:endColor="#ffffff" android:startColor="#ffffff" android:type="linear" />
<stroke android:width="1dp" android:color="#504a4b" />
<corners android:radius="5dp" />
<padding android:bottom="3dp" android:left="3dp" android:right="3dp" android:top="3dp" />
</shape></item>
<item ><bitmap android:gravity="bottom|right" android:src="#drawable/spinner_ab_default_holo_dark_am" /> // you can use any other image here, instead of default_holo_dark_am
</item>
</layer-list></item>
</selector>
Add the following lines to your styles.xml which is inside values folder
<style name="spinner_style" >
<item name="android:background">#drawable/spinner_bg</item>
<item name="android:layout_marginLeft">10dp</item>
<item name="android:layout_marginRight">10dp</item>
<item name="android:layout_marginBottom">10dp</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingTop">5dp</item>
<item name="android:paddingBottom">5dp</item>
Now add this style to your spinner as
<Spinner
android:id="#+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="#style/spinner_style"
android:popupBackground="#cccccc" />
For more detail visit here. Android add arrow image to spinner
Try drawableRight property in XML to set it on right side on spinner:
android:drawableRight="#drawable/downimage"
I have solved this problem on my side by using following simple code
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<Spinner
android:id="#+id/spinner"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:layout_alignParentRight="true"
android:src="#drawable/ambilwarna_arrow_down" />
</RelativeLayout>
Hope this will work for you .Keep coding
try to create a custom spinner using FrameLayout, I using this, and works well
<FrameLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#drawable/border_spinner_select_location"
>
<Spinner
android:spinnerMode="dialog"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/spinner_provinsi"
android:prompt="#string/promp"
android:background="#drawable/spinner_pressed"
></Spinner>
<ImageView
android:layout_width="23dp"
android:layout_height="30dp"
android:src="#drawable/ico_arrow_select_white_xxhdpi"
android:layout_gravity="right|center_vertical"
android:layout_marginRight="25dp"
/>
</FrameLayout>
for border line :
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:thickness="0dp"
android:shape="rectangle">
<solid android:color="#android:color/transparent" />
<stroke android:width="2dp"
android:color="#android:color/white" />
</shape>
for effect when your press the spinner
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:drawable="#android:color/white" />
<item android:state_pressed="true"
android:drawable="#color/deep_white_pressed_spinner" />
<item android:state_pressed="false" android:state_focused="true"
android:drawable="#android:color/holo_blue_bright" />
<item android:drawable="#color/semi_white_transparant" />
</selector>
dummy.xml (drawable should be of very less size-24dp)
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<layer-list android:opacity="transparent">
<item android:width="100dp" android:gravity="right">
<bitmap android:src="#drawable/down_button_dummy_dummy" android:gravity="center"/>
</item>
</layer-list>
</item>
</selector>
layout snippet be like...
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardUseCompatPadding="true"
app:cardElevation="5dp"
>
<Spinner
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#drawable/dummy">
</Spinner>
</android.support.v7.widget.CardView>

Align a underlined spinner in the same line beside edit text

I have a editText and a underlined spinner. I am trying to set the spinner beside the edittext in the same line. Please help me out. The Spinner always is a bit above the line of edittext.
<RelativeLayout
android:id="#+id/relativeLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relativeLayout0"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp">
<ImageView
android:id="#+id/ivRupee"
android:src="#drawable/ic_rupee_new"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerVertical="true" />
<ImageView
android:id="#+id/fake"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:id="#+id/editText"
android:layout_toRightOf="#+id/ivRupee"
android:layout_alignRight="#+id/fake"
android:layout_marginRight="5dp"/>
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/editText"
android:gravity="center"
android:layout_alignLeft="#+id/fake"
android:layout_alignParentRight="true"
android:id="#+id/spinner2"
style="#style/Widget.AppCompat.Spinner.Underlined"/>
</RelativeLayout>
I need something like this:
I had the same problem, I solved it by deleting style="#style/Widget.AppCompat.Spinner.Underlined" and setting a background to the spinner android:background="#drawable/custom_spinner_background"
custom_spinner_background.xml:
<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetBottom="8dp"
android:insetLeft="4dp"
android:insetRight="4dp"
android:insetTop="4dp">
<selector>
<item
android:state_checked="false"
android:state_pressed="false">
<layer-list>
<item
android:left="-8dp"
android:right="-8dp"
android:top="-8dp">
<shape android:shape="rectangle">
<stroke
android:width="1dp"
android:color="#color/colorAccent" />
<padding android:bottom="4dp" />
</shape>
</item>
</layer-list>
</item>
<item>
<layer-list>
<item
android:left="-8dp"
android:right="-8dp"
android:top="-8dp">
<shape android:shape="rectangle">
<stroke
android:width="2dp"
android:color="#color/colorAccent" />
<padding android:bottom="4dp" />
</shape>
</item>
</layer-list>
</item>
</selector>
</inset>
check this image
to do this just add an item spinner custom
arrayAdapter = new ArrayAdapter(this, R.layout.spinner_item, list)
and create spinner_item.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/spinner_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
tools:text="#tools:sample/lorem"
android:textColor="#android:color/black" />
The spinner should be look like this:
<Spinner
android:id="#+id/spn"
style="#style/Base.Widget.AppCompat.Spinner.Underlined"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
The code below will show the items without padding:
like this
just add another item custom: spinner_item_padding.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/spinner_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="12dp"
android:paddingLeft="12dp"
android:paddingTop="12dp"
tools:text="#tools:sample/lorem"
android:textColor="#android:color/black" />
and the java code:
arrayAdapter = new ArrayAdapter(this, R.layout.spinner_item, list)
arrayAdapter.setDropDownViewResource(R.layout.spinner_item_padding)
check this result
eat fruits and vegetables

Custom EditText: input-box type for for login page

I'm trying to create a sign-in activity. So, I chose the login activity, but the login page looks quite plane. Here's the layout I would like to implement at the login page
I'm using the following drawable layout for the changes:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:thickness="0dp"
android:shape="rectangle">
<stroke
android:width="2dp"
android:color="#C8CAD0"/>
<corners
android:radius="1dp" />
</shape>
Which gives me this:
I want the common border between the two fields to be merged into a single line of thickness 1dp.
Here's the xml for the two fields - username and password:
<AutoCompleteTextView
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="50dp"
android:hint=" Username or Email"
android:inputType="textEmailAddress"
android:background="#drawable/box_input_field"/>
<EditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#drawable/box_input_field"
android:hint=" Password"
android:imeActionId="#+id/login"
android:imeActionLabel="#string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword" />
What I do in this Method is.
Create 2 different drawables for email view and password view.
Show 2 drawables below,
I set <item android:top="-1dp"> in edittext_bottom_curv_gray.xml for make middle line thin.
This will look like this =>
<EditText
android:id="#+id/edtTxtUserEmail"
style="#style/EditTextStyle"
android:layout_width="match_parent"
android:layout_height="42dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/edittext_top_curv_gray"
android:hint="Email"
android:inputType="textEmailAddress" />
<EditText
android:id="#+id/edtTxtUserPassword"
style="#style/EditTextStyle"
android:layout_width="match_parent"
android:layout_height="42dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="-1dp"
android:background="#drawable/edittext_bottom_curv_gray"
android:hint="Password"
android:inputType="textPassword" />
Style of EditText style.xml
<style name="EditTextStyle">
<item name="android:textColor">#000000</item>
<item name="android:gravity">center_vertical</item>
<item name="android:singleLine">true</item>
<item name="android:textSize">15sp</item>
<item name="android:padding">10dp</item>
<item name="android:textColorHint">#9A9A9A</item>
Drawable 1 for email field.
edittext_top_curv_gray.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item >
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="#FFFFFF" />
<stroke
android:width="2dp"
android:color="#BBBBBB" >
</stroke>
<corners
android:topLeftRadius="3dp"
android:topRightRadius="3dp" />
</shape>
</item>
</layer-list>
Drawable 2 for password field.
edittext_bottom_curv_gray.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="-1dp">
<shape
android:shape="rectangle" >
<solid android:color="#FFFFFF" />
<stroke
android:width="2dp"
android:color="#BBBBBB" >
</stroke>
<corners
android:bottomLeftRadius="3dp"
android:bottomRightRadius="3dp" />
</shape>
</item>
</layer-list>
Check and modify according to your needs:
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:background="#drawable/rounded_linear"
android:orientation="vertical">
<AutoCompleteTextView
android:id="#+id/org_editBox"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#null"
android:hint="#string/hint_org"
android:paddingEnd="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingStart="10dp"
android:textSize="14sp" />
<View
android:id="#+id/view2"
android:layout_width="fill_parent"
android:layout_height="0.3dp"
android:background="#D3D3D3" />
<AutoCompleteTextView
android:id="#+id/salesperson_editBox"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#null"
android:hint="#string/hint_sales_person"
android:paddingEnd="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingStart="10dp"
android:textSize="14sp" />
<View
android:id="#+id/view3"
android:layout_width="fill_parent"
android:layout_height="0.3dp"
android:background="#D3D3D3" />
<EditText
android:id="#+id/orgtype_editBox"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#null"
android:hint="#string/hint_org_type"
android:paddingEnd="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingStart="10dp"
android:textSize="14sp" />
</LinearLayout>
rounded_linear.xml:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF" />
<stroke
android:width="0.3dp"
android:color="#D3D3D3" />
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<corners
android:bottomLeftRadius="5dp"
android:bottomRightRadius="5dp"
android:topLeftRadius="5dp"
android:topRightRadius="5dp" />
</shape>
You could put the two EditText in a vertical LinearLayout, and set the divider attribute to handle the line inbetween the two fields. You can then set your existing drawable as the LinearLayout bg with no change required.
To make this simple, you could:
place those edittexts inside a LinearLayout
Add a simple View between them with the background color (#C8CAD0) and the height with the same value as the stroke (2dp)
set box_input_field as the LinearLayout background

Effect in EditText from xml

I am trying to give shadow effect as shown below to edittext
but i am unable to do it. Below is what i have done till now
My code are as follow:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/background" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" >
<LinearLayout
android:id="#+id/layout_linear_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/img_6parcels"
android:layout_centerInParent="true"
android:layout_marginBottom="10dp"
android:background="#drawable/screen_background"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="20dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="20dp" >
<EditText
android:id="#+id/edit_text_domain"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:gravity="center"
android:hint="Domain"
android:paddingBottom="3dp"
android:background="#drawable/edittext_shadow"
android:paddingTop="3dp">
<requestFocus />
</EditText>
<ImageView
android:id="#+id/address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:src="#drawable/slice_address_transparent" />
<EditText
android:id="#+id/edit_text_invinzee"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/edittext_shadow"
android:gravity="center"
android:hint="Invinzee"
android:paddingBottom="3dp"
android:paddingTop="3dp" />
<EditText
android:id="#+id/edit_text_password"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/edittext_shadow"
android:gravity="center"
android:hint="Password"
android:inputType="textPassword"
android:paddingBottom="3dp"
android:paddingTop="3dp" />
<Button
android:id="#+id/log_in_Button"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginTop="25dp"
android:gravity="center"
android:text="LOGIN" />
</LinearLayout>
<LinearLayout
android:id="#+id/img_6parcels"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:layout_marginTop="20dp" >
<ImageView
android:id="#+id/parcel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:src="#drawable/six3_03" />
</LinearLayout>
<TextView
android:id="#+id/text_delivery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/layout_linear_login"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Perfect Job"
android:textColor="#353f41" />
</RelativeLayout>
</RelativeLayout>
My edittext_shadow.xml is as follow:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- most important is order of layers -->
<!-- Bottom right side 2dp Shadow -->
<item >
<shape android:shape="rectangle">
<solid android:color="#660099" />
</shape>
</item>
<!-- Bottom 2dp Shadow -->
<item>
<shape android:shape="rectangle">
<solid android:color="#660099" />
</shape>
</item>
<!-- White Top color -->
<item android:top="-3px" android:left="-3px">
<shape android:shape="rectangle">
<solid android:color="#86ae0b" />
</shape>
</item>
</layer-list>
I tried as shown in this link Add drop shadow effects to EditText Field but unable to accomplish it.
Any Help!!!
Thanks, Guys For helping.
Mixing code from Add drop shadow effects to EditText Field and answer from babar sanah I was able to find the solution.
My solution is as below:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- most important in order of layers -->
<!-- Bottom right side 2dp Shadow -->
<item >
<shape android:shape="rectangle">
<gradient
android:angle="270"
android:endColor="#333333"
android:centerColor="#86ae0b"
android:startColor="#666666" />
</shape>
</item>
<!-- Bottom 2dp Shadow -->
<item>
<shape android:shape="rectangle">
<gradient
android:angle="270"
android:endColor="#333333"
android:centerColor="#86ae0b"
android:startColor="#666666" />
</shape>
</item>
<!-- White Top color -->
<item android:top="5px" android:left="5px">
<shape android:shape="rectangle">
<gradient
android:angle="-90"
android:endColor="#333333"
android:centerColor="#86ae0b"
android:startColor="#666666" />
</shape>
</item>
</layer-list>
Thanks alot for the help it means a lot to me.
Why you didn't try gradient? If it is possible please let me know..
<gradient
android:angle="270"
android:centerColor="#color/shadow_alpha"
android:endColor="#color/shadow_alpha1"
android:startColor="#color/shadow_alpha2" />
Define the colors as per your need..
create an xml shape.xml put in drawable folders and give your edit text background
android:background="#drawable/shape"
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:padding="10dp">
<!-- you can use any color you want I used here gray color-->
<gradient android:angle="-90"
android:endColor="#436EEE"
android:startColor="#436EEE"
android:centerColor="#4876FF" />
</shape>

Categories

Resources