Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change EditText bubble color (under cursor) in android?

How to change the color of EditText bubble in android, I could do change the cursor drawable but I want change color of Bubble, please share idea on it.

Reference screenshot:

enter image description here

Any help would be appreciated.

like image 579
Hiren Patel Avatar asked Feb 11 '16 11:02

Hiren Patel


3 Answers

You can change all your EditText bubbles and bar colors setting the accent color in your AppTheme.

<style name="AppTheme" parent="Base.Theme.AppCompat.Light">
    <item name="colorPrimary">@color/indigo</item>
    <item name="colorAccent">@color/pink</item>
</style>

Or you could just change one single EditText with the android:theme attribute of your component.

<style name="MyEditText" parent="Theme.AppCompat.Light">  
   <item name="colorControlNormal">@color/indigo</item>
   <item name="colorControlActivated">@color/pink</item>
</style>  

<EditText  
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="Hint text"
    android:theme="@style/MyEditText"
    />
like image 70
saulmm Avatar answered Oct 16 '22 07:10

saulmm


Change the color in your res/values/styles.xml. The bubble uses colorAccent:

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
    <!-- Other theme overrides here -->
    <item name="colorAccent">@color/Gray2</item>
</style>

In the above <item name="colorAccent">@color/Gray2</item> is the line where you put the color you want for your bubble.

like image 24
AndroidMechanic - Viral Patel Avatar answered Oct 16 '22 08:10

AndroidMechanic - Viral Patel


http://developer.android.com/training/material/theme.html#ColorPalette

<resources>
  <!-- inherit from the material theme -->
  <style name="AppTheme" parent="android:Theme.Material">
    <!-- Main theme colors -->
    <!--   your app branding color for the app bar -->
    <item name="android:colorPrimary">@color/primary</item>
    <!--   darker variant for the status bar and contextual app bars -->
    <item name="android:colorPrimaryDark">@color/primary_dark</item>
    <!--   theme UI controls like checkboxes and text fields -->
    <item name="android:colorAccent">@color/accent</item>
  </style>
</resources>

And check this: theme UI controls like checkboxes and text fields

<!--   theme UI controls like checkboxes and text fields -->
        <item name="android:colorAccent">@color/accent</item>

Was it so hard to find? :)

like image 3
ʍѳђઽ૯ท Avatar answered Oct 16 '22 06:10

ʍѳђઽ૯ท