Character counter

From the Google Material Design documentation

Use a character counter in fields where a character restriction is in place.

How to add?

I. Add the last version of the appcompat library to your build.gradle file.

dependencies {  
    compile 'com.android.support:appcompat-v7:X.X.X' 
    // where X.X.X is the last version available 
}

II. Declare your EditText inside any layout.xml file and wrap it with TextInputLayout. Add app:counterEnabled attribute and set it value to true. To restrict maximum characters count set some integer value to app:counterMaxLength attribute.

<android.support.design.widget.TextInputLayout  
        android:id="@+id/inputLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:counterEnabled="true"
        app:counterMaxLength="140" >

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="hint text" />

</android.support.design.widget.TextInputLayout>  

How to style?

To define a custom style for the overflow.

I. Define the text style.

<!--Overflow label text style-->  
<style name="MyOverflowText" parent="TextAppearance.AppCompat.Small">  
    <item name="android:textColor">@color/deep_orange</item>
</style>  

II. Apply this styles to your TextInputLayout via app:counterOverflowTextAppearance attribute.

app:counterOverflowTextAppearance="@style/MyOverflowText"