프로그래밍

안드로이드 테마 질문!

인터넷 강의에서 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
무분별한 사용은 차단될 수 있습니다.
번호 제목 글쓴이 추천 수 날짜 조회 수
5701 [프로그래밍] 파이썬 1도 모르는데 GPT로 프로그램 뚝딱 만듬 2 푸르딩딩 1 11 시간 전 262
5700 [프로그래밍] 담주 면접잡혔는데 2 삐라루꾸 0 17 시간 전 234
5699 [프로그래밍] 아두이노 부트로더를 구웠는데.. 4 렙이말한다ㅡ니가옳다 0 1 일 전 163
5698 [프로그래밍] IOS 개발자 있나여? 1 g4eng 0 3 일 전 208
5697 [프로그래밍] 시스템 디자인 인터뷰 준비 도움좀!!! 1 Nognhyup 0 4 일 전 166
5696 [프로그래밍] 최근에 vscode 쓴 사람 도움! 3 172102 0 5 일 전 334
5695 [프로그래밍] 책을 또 사버리고 말았다... 1 찰나생멸 2 5 일 전 331
5694 [프로그래밍] 윈도우 부팅화면 봐주실분 1 바나나맛두부 0 8 일 전 211
5693 [프로그래밍] 아 시발 퇴사마렵다 9 인간지표 0 9 일 전 529
5692 [프로그래밍] C#이 ㅈ사기 언어인 이유 19 ye 6 9 일 전 1077
5691 [프로그래밍] 요즘 모바일 개발은 어떤 걸 사용하나요? 14 커피좋아용 0 11 일 전 470
5690 [프로그래밍] 취준생 안드로이드 팀플 주제 머할까요... 8 조강현 0 12 일 전 269
5689 [프로그래밍] 공통코드테이블은 대체 왜 만드냐 9 잠적자 0 13 일 전 525
5688 [프로그래밍] 토이프로젝트 주제 선정 3 개드립눈팅1세대 0 13 일 전 263
5687 [프로그래밍] 엥 구글 플러터 유기각 재는거임?? 4 최수연 0 16 일 전 497
5686 [프로그래밍] 반도체 장비 업계인 있음? 9 캡틴띠모 0 16 일 전 382
5685 [프로그래밍] 안드로이드 책 추천좀 6 집에가게해줘 0 17 일 전 202
5684 [프로그래밍] 폰 스크리닝 해 본 사람 있어? 3 무지개빛푸딩 0 18 일 전 464
5683 [프로그래밍] jsp 트리메뉴 만들고있는데 구상한게가능한지 의견좀물어볼께 11 평택국 0 18 일 전 192
5682 [프로그래밍] JPA 도와줘어억 ㅠ 10 모그리또 0 18 일 전 300