마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

버튼을누르면 배경색이 바뀌도록했습니다. 그런데 버튼이 거슬리는데 어떻게 해야되나요?

0 추천

버튼은 회색이고 버튼을누르면 R,G,B, 검은색,하양 으로 배경색이 바뀌도록했습니다.

화면 전체가 빨,검,초,파,흰색 으로 변하게 하고싶은데

어떻게해야되나요? 액티비티를 새로 만들어야되는건가요?

 

T43같은 휴대용 디스플레이 샀을때 불량화소 검사하던것처럼 화면 전체가 색깔이 나오게 하고 싶은거거든요.

또 만약에 제가  RGB (0.100.100) 이런식으로 색상의 값을 조절하고싶은데 

어떻게해야지 색상조절을 할수있나요?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" 
    tools:context=".MainActivity"
    android:id="@+id/rl_background"
     >

    <TextView
        android:id="@+id/textview01"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

    
    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="버튼을누르면 빨강"
        android:onClick="myClickListener"
        android:padding="25dp"
        />
    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="버튼을 누르면 하양"
        android:onClick="myClickListener1"
        android:padding="25dp"
        />
    <Button
        android:id="@+id/button3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="버튼을 누르면 green"
        android:onClick="myClickListenergreen"
        android:padding="25dp"
        />
    <Button
        android:id="@+id/button4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="버튼을 누르면 blue"
        android:onClick="myClickListenerblue"
        android:padding="25dp"
        />
    <Button
        android:id="@+id/button5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="버튼을 누르면 black"
        android:onClick="myClickListenerblack"
        android:padding="25dp"
        />
 </LinearLayout>

 

익명사용자 님이 2013년 10월 28일 질문

2개의 답변

0 추천
 
채택된 답변
화면 전체를 한가지 색깔로 나오게 하려면, 새로운 activity를 띄우거나 Dialog를 화면에 꽉차게 띄워주면 됩니다.

FULL_SCREEN 속성을 주면 화면에 꽉차는 화면을 만들수 있습니다. ( NO_TITLE 속성도 같이 주세요 )
코비나 (1,580 포인트) 님이 2013년 10월 28일 답변
0 추천
각 버튼마다 클릭 이벤트가 존재 한다면 배경으로 이용되는 리니어 레이아웃에 백그라운드를 변경 하면 될것 같습니다다

 



View view = findViewById(R.id.r1_background);

view.setBackgroundColor(0xffff0000); // red
aucd29 (218,390 포인트) 님이 2013년 10월 28일 답변
...