I was wondering what the best way to fade out a edit text field programmatically?
For example I would like the edit text field to look something like this:
Currently I am just using static images that I fade out using gimp, but I would to change them all to faded edit text fields.
Any input is greatly appreciated!
You can achieve similar result with gradient.
First create in drawable forlder xml file with shape
element, for example:
<!-- mygradient.xml -->
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/black" />
<gradient
android:angle="90"
android:centerColor="@color/grey"
android:endColor="@color/white"
android:startColor="@color/black"
android:type="linear" />
</shape>
Next use your xml as background for some view:
<TextView
android:background="@drawable/mygradient"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
For more info about shape drawable and gradients look here