프로그래밍

안드로이드 테마 질문!

인터넷 강의에서 Theme 관련 해서 자세한 설명이 없어서 모르겠는데

아래 소스 처럼 com.google.android.material.textfield.TextInputLayout 을 사용해서 TextInput view를 만들었는데

적용이 안 되길레 Theme.xml에 Base.Theme을 

Theme.AppCompat.DayNight.NoActionBar -> Theme.MaterialComponents.DayNight.NoActionBar

로 변경을 해줘야 되긴 하더라고. 

 

아래가 적용 이미지

Screenshot_20240108_211238.png

(테마가 검정인데 선이 검정색이라 잘 안 보이지만 검은 테투리의 TextInput 상자가 있음)

 

내가 사용하려는 기능이 MaterialComponents에 있는데 기본 설정을 AppCompat을 사용해서 그런거라 생각하는데...

문제는 버튼 색상이 보라색으로 고정이 됨..

내 생각에는 기본 테마를 설정을 했더라도 내가 버튼의 Background를 따로 지정을 했으면 그걸로 바껴야 정상 아님???

 

보통 이런건 어떻게 해결 함?

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<LinearLayout
    android:id="@+id/llSelectDates"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintTop_toBottomOf="@id/toolbarHistory"
    android:orientation="horizontal"
    android:gravity="center"
    android:padding="10dp"
    >
 
    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/tilStartDate"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        app:boxStrokeColor="@color/black"
        app:hintTextColor="@color/black"
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
        android:layout_weight="2">
 
        <androidx.appcompat.widget.AppCompatEditText
            android:id="@+id/etStartDate"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="17sp"
            />
 
    </com.google.android.material.textfield.TextInputLayout>
 
    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/tilEndDate"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        app:boxStrokeColor="@color/TeaGreen"
        app:hintTextColor="@color/black"
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
        android:layout_weight="2">
 
        <androidx.appcompat.widget.AppCompatEditText
            android:id="@+id/etEndDate"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="17sp"
            />
 
    </com.google.android.material.textfield.TextInputLayout>
 
    <Button
        android:id="@+id/btnSearch"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="조회"
        android:textStyle="bold"
        android:textSize="17sp"
        android:textColor="@color/white"
        android:background="@color/ButtonGreen"
        />
</LinearLayout>
cs

 

 

5개의 댓글

2024.01.08

그래서 나는 마테리얼거 잘 안쓰는편..

0
2024.01.08
@닉네임대충짓

그냥 ㅅㅂ 감안 하고 쓰던가 아니면 안 쓰던가 해야 하는거야? 정말????

0
2024.01.08
@집에가게해줘

ㅋㅋㅋ 지맘대론게 너무많음 마테리얼

저거 아마 android:background 말고 다른 속성 참조할텐데, 그게 뭔지 하나하나 찾아보거나

 

걍 딴거쓰거나..

 

회사에서는 대부분 디자인문서가 있기떄문에 마테리얼 쓸일이 없음

0
2024.01.08

내 기억으론 백그라운드 말고 tint인가 tintColor였던가

0
2024.01.08
@힝거루

이거네.

android:backgorund 에서 app:backgroundTint 쓰니까 색상이 바뀌네..

그러면 배경이나 테두리 이것저것 다 material 버전의 properties를 찾아서 바꿔야 겠네?

 

왜 이따구로 처 만든건지 모르겠지만 뭐... 다 이유가 있었겠지?

어쨌든 고맙다 ㅜㅜ

0
무분별한 사용은 차단될 수 있습니다.
번호 제목 글쓴이 추천 수 날짜 조회 수
5719 [프로그래밍] 하이브리드 웹뷰기반 앱은 rn이 정석이야? 3 잠적자 0 18 시간 전 159
5718 [프로그래밍] c# webview2 도움요청함.. 7 carpediem 0 23 시간 전 116
5717 [프로그래밍] 현업 개발자형들 맥씀? 9 이또히로부미 0 1 일 전 209
5716 [프로그래밍] libtorch에서 cuda 안불러와지는거 도움! 2 Hakat 0 2 일 전 123
5715 [프로그래밍] 뭔가 게시판이 애매해서 그런데 gis 잘아는 사람? 1 하늘늑대 0 3 일 전 163
5714 [프로그래밍] 컴포즈가 프리뷰랑 폰에서 다르게 동작해요 1 집에가게해줘 0 3 일 전 118
5713 [프로그래밍] 난바보다) 크로미움 램사용량 문제 일단 해결 2 ye 0 4 일 전 282
5712 [프로그래밍] k8s DNS 이슈는 해결이 안되나보다. 잉텔 0 5 일 전 171
5711 [프로그래밍] 분노) 진짜 유튜브 구글 패악질 토나오네 씨발 17 ye 0 6 일 전 769
5710 [프로그래밍] 프론트엔드 공부하려는데 언어 추천좀 7 스트리플 0 7 일 전 350
5709 [프로그래밍] 객체지향 뽕에 취하지마라 8 69746974 2 8 일 전 407
5708 [프로그래밍] 요즘 앱개발 인력시장 어떰..3년차 2 센치해요 0 11 일 전 387
5707 [프로그래밍] 컴포즈 Box 컴포넌트가 안 나와... 1 집에가게해줘 0 13 일 전 148
5706 [프로그래밍] 아 ssl 적용햇는데 개정신없네 9 넌또화나있네 0 13 일 전 305
5705 [프로그래밍] 패스트 캠퍼스 <---- 얘내는 가격 인상 원툴임? 5 조강현 0 16 일 전 398
5704 [프로그래밍] 클라가 파이썬 셀레니움같은거 써서 클릭하고 그러는걸 감지 ... 5 리옴므 0 17 일 전 265
5703 [프로그래밍] leetcode 50일 달성 1 JimmyMcGill 1 17 일 전 237
5702 [프로그래밍] 그냥 개인공부용 git 만들건데 5 년째재수강 0 17 일 전 336
5701 [프로그래밍] html 자바스크립트 질문 19 책걸이 0 18 일 전 370
5700 [프로그래밍] 아니 시바 이게 무슨일이야 4 인간지표 0 18 일 전 380