Friday, 5 October 2018

Editing MultiAutocompleteTextView style

Similar questions

Apply a style on MultiAutoCompleteTextView : the issue was due to the fact that the OP was intenting to override some attributes the style didn't declare. This is not my problem.

android: MultiAutoCompleteTextView style like gmail : here, the OP wants to set the same style as GMail, and the answer shows 2 API. Moreover, no XML code is shown. Thus, it's very different from my question and expects.

The problem

My material MultiAutoCompleteTextView style doesn't seem to be applied. More precisely, I just want to make the bottom default line of my (material!) widget become yellow and 1px of height. By default, it's gray and perhaps 3px of height, as you can see below.

enter image description here (this is displayed when my activity's fragment starts, and this is the default material style of this MultiAutoCompleteTextView)

What I have tried

A lot of things! :-)

  1. I defined a style in my app's theme to override android:autoCompleteTextViewStyle (NB: android:autoCompleteTextViewStyle doesn't exist)

  2. In the override, I tried to a) set colors - background color, color, accent color, colorControlNormal, colorFocusedHighlight, etc. etc. etc. - and b) set a background, defined in a XML file. Nothing worked.

Sources

App's theme

<style name="" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:autoCompleteTextViewStyle">@style/my_autoCompleteTextViewStyle</item>
    </style>

@style/my_autoCompleteTextViewStyle

<style name="my_autoCompleteTextViewStyle" parent="android:Widget.Material.Light.AutoCompleteTextView">
    <item name="android:background">@drawable/background_autocompletetextview</item>

    <item name="android:color">@color/colorRichYellow</item>
    <item name="android:borderlessButtonStyle">@color/colorRichYellow</item>
    <item name="android:colorAccent">@color/colorRichYellow</item>
    <item name="android:colorControlHighlight">@color/colorRichYellow</item>
    <item name="android:colorActivatedHighlight">@color/colorRichYellow</item>
    <item name="android:colorControlActivated">@color/colorRichYellow</item>
    <item name="android:colorControlNormal">@color/colorRichYellow</item>
    <item name="android:colorBackground">@color/colorRichYellow</item>
    <item name="android:colorFocusedHighlight">@color/colorRichYellow</item>
</style>

@drawable/background_autocompletetextview

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line">
    <stroke android:width="1dp" android:color="@color/colorRichYellow" />
</shape>

My question

I don't understand why it doesn't work. I already did that for a spinner (select box), and it perfectly worked... How could I make it work for my material MultiAutoCompleteTextView?



from Editing MultiAutocompleteTextView style

No comments:

Post a Comment