these are how my spinner and edit text looks like :
these are spinner and edit text that I saw somewhere else and I liked them :
How can I change my edittext and spinners to looks the second image ?
I'm using app compact anyway
thanks
these are how my spinner and edit text looks like :
these are spinner and edit text that I saw somewhere else and I liked them :
How can I change my edittext and spinners to looks the second image ?
I'm using app compact anyway
thanks
This is the best tool that you can use for all views and its FREE many thanks to @Jérôme Van Der Linden.
The Android Holo Colors Generator allows you to easily create Android components such as EdiText
or spinner with your own colors for your Android application. It will generate all necessary nine patch assets plus associated XML drawable and styles which you can copy straight into your project.
UPDATE 1
This domain seems expired but project is open source you can find here
try it
this image put in background of EditText
android:background="@drawable/textfield_activated"
UPDATE 2
For API 21 or higher, you can use android:backgroundTint
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Underline color change"
android:backgroundTint="@android:color/holo_red_light" />
Update 3
Now We have with back support AppCompatEditText
Note: We need to use app:backgroundTint instead of android:backgroundTint
<android.support.v7.widget.AppCompatEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Underline color change"
app:backgroundTint="@color/blue_gray_light" />
Set Background for Spinner and EditText will help you to figure it out.
<Spinner android:id="@+id/spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/spinner_bg"/>
<EditText android:id="@+id/edittext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/edittext_bg"/>
</LinearLayout>
By now I can guide you for EditText section ..
Define your style drawable like this ..
res/drawable/edit_text_style.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape >
<solid android:color="@color/wine_red" />
</shape>
</item>
<!-- main color -->
<item android:bottom="1.5dp"
android:left="1.5dp"
android:right="1.5dp">
<shape >
<solid android:color="@color/white" />
</shape>
</item>
<!-- draw another block to cut-off the left and right bars -->
<item android:bottom="5.0dp">
<shape >
<solid android:color="@color/white" />
</shape>
</item>
</layer-list>
Now define same in your EditText like this ..
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.vivektest.MainActivity" >
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<EditText
android:background="@drawable/edit_text_style"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/et_main"
android:imeOptions="actionSearch"
android:singleLine="true"
/>
</RelativeLayout>
Hope it helps!
Solution for spinner style: Create a custom adapter with a custom layout for your spinner.
Spinner spinner = (Spinner) findViewById(R.id.pioedittxt5);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.travelreasons, R.layout.simple_spinner_item);
adapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
R.layout.simple_spinner_item
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="@style/spinnerItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee" />
R.layout.simple_spinner_dropdown_item
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="@style/spinnerDropDownItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="?android:attr/dropdownListPreferredItemHeight"
android:ellipsize="marquee" />
In styles add your custom dimensions and height as per your requirement.
<style name="spinnerItemStyle" parent="android:Widget.TextView.SpinnerItem">
</style>
<style name="spinnerDropDownItemStyle" parent="android:TextAppearance.Widget.TextView.SpinnerItem">
</style>
Taken from here