본문 바로가기

Mobile/Android

[ Android ] 커스텀 레이아웃 색 변경

반응형


drawable 폴더에 xml 생성 ( layout_button_selector.xml )

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@color/layout_press" android:state_pressed="true"></item>
    <item android:drawable="@color/layout_unpress" android:state_focused="true"></item>
    <item android:drawable="@color/layout_unpress" ></item>
</selector>

 

반응형



*** 적용 ***

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:background="@drawable/layout_button_selector">



반응형