프로그래밍

안드로이드 테마 질문!

인터넷 강의에서 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
무분별한 사용은 차단될 수 있습니다.
번호 제목 글쓴이 추천 수 날짜 조회 수
180925 [견적] 컴알못인데 완본체 이거 사도되나요?? 사이버전사1 0 13 분 전 14
180924 [잡담] 역시 알리가 최고시다 4 빠빠양 2 38 분 전 66
180923 [컴퓨터] 파워 낮은거 쓰면 컴터 터지나??? 8 정상에서만납시다 0 1 시간 전 93
180922 [잡담] 솔직히 컴부품에 이렇게 관심 많으면서 3 섭탱 0 2 시간 전 85
180921 [컴퓨터] 인텔 cpu 뒤에붙은 k랑 kf랑 무슨 차이임? 14 룽니 0 3 시간 전 151
180920 [모바일] 카툭튀 보호 필름 씀? 4 스피오스피오스피... 0 4 시간 전 81
180919 [모바일] 플스랑 ott밖에 안 해도 티비 가입 해야됨?? 3 몽땅팔 0 6 시간 전 87
180918 [잡담] 독거미 f87 pro 후기 5 하이웨이 0 7 시간 전 256
180917 [컴퓨터] 메모리는 정상인데... 21 오이혐오자 0 7 시간 전 86
180916 [모바일] 스마트폰 바꿨는데, 보호필름이 존나 시발새끼네-해결완료 5 샛별 0 8 시간 전 178
180915 [잡담] 서브컴 맞췄다아 !! 4 차원에서사는인간 1 11 시간 전 156
180914 [모바일] 아이폰 12프로 -> 15 프로맥스 or 배터리 변경 13 루시퍼모닝스타 0 13 시간 전 240
180913 [잡담] 이정도면 한 40에도 사가려나? 4 함박눈 0 19 시간 전 222
180912 [잡담] 크롬캐스트 4세대 4k 샀는데 이거 전원끄는법없음? 1 폰뉴비 0 22 시간 전 208
180911 [잡담] 처음으로 5등급? CPU 써봄 17 익명36 0 22 시간 전 462
180910 [컴퓨터] 램 부족하면 그냥 사서 끼우면 되죵? 3 장성규 0 22 시간 전 143
180909 [모바일] 이런 충전기 있을까? 2 cw 7 0 22 시간 전 121
180908 [컴퓨터] 2070s 에서 rx6800 업글 할만한가요?? 4 나니니오우 0 23 시간 전 132
180907 [잡담] 고스트 오브 쓰시마 amd 최적화 장난 아니네 10 Nei 0 23 시간 전 184
180906 [컴퓨터] 당근에서 중고컴 샀는데 모니터가 안 켜짐.. 4 IlIllllIlllI 0 23 시간 전 133