프로그래밍

안드로이드 테마 질문!

인터넷 강의에서 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
무분별한 사용은 차단될 수 있습니다.
번호 제목 글쓴이 추천 수 날짜 조회 수
5709 [프로그래밍] 패스트 캠퍼스 <---- 얘내는 가격 인상 원툴임? 3 조강현 0 18 시간 전 216
5708 [프로그래밍] 클라가 파이썬 셀레니움같은거 써서 클릭하고 그러는걸 감지 ... 5 리옴므 0 1 일 전 180
5707 [프로그래밍] leetcode 50일 달성 1 JimmyMcGill 1 1 일 전 155
5706 [프로그래밍] 그냥 개인공부용 git 만들건데 4 년째재수강 0 2 일 전 237
5705 [프로그래밍] html 자바스크립트 질문 19 책걸이 0 2 일 전 290
5704 [프로그래밍] 아니 시바 이게 무슨일이야 4 인간지표 0 3 일 전 305
5703 [프로그래밍] 아두이노 키트 아무것도 모르고 사도 될까? 6 그것 0 3 일 전 253
5702 [프로그래밍] 횽들 Vimeo에 올라가있는 동영상의 원본크기를 확인할 수 있... 13 카뜨만두 0 3 일 전 181
5701 [프로그래밍] c# 이벤트와 델리게이트 13 RX7900XTX 0 6 일 전 304
5700 [프로그래밍] Aws 람다에 파이썬 올려서 결과 받아오는데 11 아르피쥐 0 8 일 전 342
5699 [프로그래밍] 마리아DB mediumtext 그냥 쓰고 싶은데 21 잉텔 0 8 일 전 220
5698 [프로그래밍] 안드로이드 씹뉴비 질문이요 2 집에가게해줘 0 8 일 전 125
5697 [프로그래밍] c언어 7년했는데 이런게 되는거 처음알았음.. 4 케로로중사 0 10 일 전 890
5696 [프로그래밍] 파이썬 1도 모르는데 GPT로 프로그램 뚝딱 만듬 2 푸르딩딩 1 13 일 전 741
5695 [프로그래밍] 담주 면접잡혔는데 8 삐라루꾸 0 13 일 전 499
5694 [프로그래밍] 아두이노 부트로더를 구웠는데.. 4 렙이말한다ㅡ니가옳다 0 14 일 전 233
5693 [프로그래밍] IOS 개발자 있나여? 1 g4eng 0 16 일 전 260
5692 [프로그래밍] 시스템 디자인 인터뷰 준비 도움좀!!! 1 Nognhyup 0 17 일 전 201
5691 [프로그래밍] 최근에 vscode 쓴 사람 도움! 3 172102 0 18 일 전 523
5690 [프로그래밍] 책을 또 사버리고 말았다... 1 찰나생멸 2 18 일 전 523