개발일기

23.08.09 부트캠프 31일차 TIL 레지스터공부, 버튼색 글자색, 그림 바꿈 성공

빛나는맛과탕탕 2023. 8. 9. 14:24
반응형

꾸역꾸역 한개씩

 

팀장님께서 리니어레이아웃

 

style : ?attr/buttonStryle

 

 

드디어 클릭하는 순간 색이 바뀌었습니다.

 

 

 

탄력받아서 그림도 바뀌게 되었고

 

탄력받아서 글자도 바꿀수 있게 되었습니다.

 

코드 구현이 아니라 설정 하는 부분이여서 꾸역꾸역 해결 해 보았습니다.

 

 

 <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/btn_close"
        android:layout_width="300dp"
        android:layout_height="60dp"
        android:layout_marginTop="20dp"
        android:layout_marginBottom="32dp"
        android:background="@drawable/selector_button"
        android:clickable="true"// 추가 안해서 기능이 문제가 생김
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.495"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/home_btn_end"
        app:layout_constraintVertical_bias="0.489">

<android.widget.ImageView
            android:id="@+id/imageView2"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:src="@drawable/btn_drawable_selector"
            android:checked="true"// 추가 안해서 기능이 문제가 생김 
            android:clickable="true"//추가 안해서 기능이 문제가 생김
            android:focusable="true"// 추가 안해서 기능이 문제가 생김
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="@id/textView2"
            app:layout_constraintHorizontal_chainStyle="packed"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            tools:srcCompat="@tools:sample/avatars" />

<androidx.appcompat.widget.AppCompatTextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="종료"
            android:textSize="30dp"
            android:checked="true"// 추가 안해서 기능이 문제가 생김
            android:clickable="true"// 추가 안해서 기능이 문제가 생김
            android:focusable="true"// 추가 안해서 기능이 문제가 생김
            android:textColor="@drawable/btn_txt_selector"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@id/imageView2"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintVertical_bias="0.476" />
            
            </androidx.constraintlayout.widget.ConstraintLayout>

 

 

반응형