안녕하세요..
대략소스는 아래와같습니다..
인터넷에서 찾아서 해봤는데요..
제가 하고 싶은것은
메인화면에서 색상변경 버튼을 클릭해서 색상바꾸는 화면으로 들어가서 색상을 바꾸면
거기에만 적용이되고 다시 메인화면으로 돌아가면 거기에는 바뀌지 않는데요
어떻게 하면 좋을까요??
꼭좀 도와주세요^^
public class Color extends Activity {
/** Called when the activity is first created. */
Button btn1,btn2,btn3,btn4;
TextView selection;
LinearLayout linear_layout;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.color);
selection = (TextView) findViewById(R.id.selection);
linear_layout = (LinearLayout) findViewById(R.id.layout);
// final String strString = getResources().getString(R.color.red);
// button1 - 빨간색 버턴 누를 경우
btn1 = (Button) findViewById(R.id.Button1);
btn1.setOnClickListener( new View.OnClickListener(){
public void onClick(View view){
selection.setText(R.string.red);
int color = getResources().getColor(R.color.red);
linear_layout.setBackgroundColor(color);
}
}
);