Customizing EditText Appearance with Appcompat v7
Android's AppCompat v7 library maintains consistency across various Android versions. However, users may encounter difficulties altering the appearance of EditTexts, particularly the bottom line and accent colors.
Initially, attempting to modify the edit style through android:editTextStyle was unsuccessful. Properties such as background color and text color could be changed but not the bottom line or accent colors. Exploration into custom drawable images via android:background and specific property values also proved futile.
After examining Android API 21 sources, it was hypothesized that colorControlActivated and colorControlNormal were used to control EditText appearance. Overriding these properties in the EditText style, however, had no effect.
Finally, a solution was discovered. By overriding colorControlActivated, colorControlHighlight, and colorControlNormal in the app theme definition, the desired color customizations could be achieved.
Applying this theme to an activity will result in the desired EditText appearance.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3