밍쯔와 안작고 안귀여운 에러들🖤

[Android] fragment의 button에 backgroundColor 및 textSize 등 적용안되는 오류 본문

Develop/Android | iOS

[Android] fragment의 button에 backgroundColor 및 textSize 등 적용안되는 오류

밍쯔 2022. 7. 15. 11:39

style=Apptheme 으로 "Theme.MaterialComponents.Light.NoActionBar"을 사용하고 있음에도

왜인지,,,, activity에서는 button으로 잘 적용되던 drawable들이 fragment에서 적용이 안된다•••

 

fragment에서 동적으로 바인딩해서 설정해봐도 적용이 안되더랍니다,,하하 왜이러냐 싶어서

 

확인해보니 naver Map을 보여주는 fragment 설정이 "Theme.AppCompat.Light.NoActionBar"로 되어 있어서 그런것,, 같다,,! 아마,,,!

 

그래서xml에서 button"androidx.appcompat.widget.AppCompatButton" 으로 바꿔주니 해결 !_!

 

Button 으로 설정
AppCompat 으로 설정

 

 

 

[참고]

https://developer.android.com/reference/androidx/appcompat/widget/AppCompatButton

 

AppCompatButton  |  Android Developers

androidx.wear.watchface.complications.rendering

developer.android.com

https://stackoverflow.com/questions/31858374/android-button-background-color-not-changing

 

Android Button background color not changing

In this android project im creating a default button style. my styles.xml <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item

stackoverflow.com

https://stackoverflow.com/questions/30556804/difference-between-an-appcompat-view-and-a-normal-android-view

 

Difference between an AppCompat view and a normal Android view

What is the difference between an AppCompat view component and a standard/default view component? For example, the difference between an AppCompatEditText, and an EditText, or between an AppCompat...

stackoverflow.com

https://stackoverflow.com/questions/64715253/cant-change-buttons-background-color-in-xml-android-studio

 

Can't change button's background color in XML .Android studio

I created TableLayout then buttons. The button's color was automatically set purple. So I can't change them right now. It's my first time here.

stackoverflow.com