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

라디오 버튼에 텍스트 뿌리기

0 추천
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.order);

  mDataList = new ArrayList<String>();
  mButton[0] = (RadioButton) findViewById(R.id.numButton1);
  mButton[1] = (RadioButton) findViewById(R.id.numButton2);
  mButton[2] = (RadioButton) findViewById(R.id.numButton3);
  mButton[3] = (RadioButton) findViewById(R.id.numButton4);
  mButton[4] = (RadioButton) findViewById(R.id.numButton5);
  mButton[5] = (RadioButton) findViewById(R.id.numButton6);
  mButton[6] = (RadioButton) findViewById(R.id.numButton7);
  mButton[7] = (RadioButton) findViewById(R.id.numButton8);
  mButton[8] = (RadioButton) findViewById(R.id.numButton9);
  mButton[9] = (RadioButton) findViewById(R.id.numButton10);
  mButton[10] = (RadioButton) findViewById(R.id.numButton11);
  mButton[11] = (RadioButton) findViewById(R.id.numButton12);
  mButton[12] = (RadioButton) findViewById(R.id.numButton13);
  mButton[13] = (RadioButton) findViewById(R.id.numButton14);
  mButton[14] = (RadioButton) findViewById(R.id.numButton15);
  mButton[15] = (RadioButton) findViewById(R.id.numButton16);
  mButton[16] = (RadioButton) findViewById(R.id.numButton17);
  mButton[17] = (RadioButton) findViewById(R.id.numButton18);
  mButton[18] = (RadioButton) findViewById(R.id.numButton19);
  mButton[19] = (RadioButton) findViewById(R.id.numButton20);
  // 버튼들에 대한 클릭리스너 등록 및 각 버튼이 클릭되었을 때 출력될 메시지 생성(리스트)
  for(int i = 0 ; i < 20 ; i++)
  {
   //mButton[i].setFocusable(false);
   mButton[i].setOnClickListener(this); // 클릭 리스너 등록   
  }
public void onClick(View v){ // 버튼 클릭 이벤트
  final RadioButton newButton = (RadioButton) v;

  Button orderButton = (Button)findViewById(R.id.button1);
  orderButton.setOnClickListener(new OnClickListener() {
   public void onClick(View v) {
    newButton.setText(phoneAddress());
   }
  });

단순 버튼으로 만들었을땐 제대로 뿌려졌는데

라디오버튼으로 바꾸고 나선 버튼에 텍스트가 안뿌려지네요..;;

implements 나 onClick() 의 문제인가요?

뽀송방댕이 (520 포인트) 님이 2013년 10월 10일 질문

1개의 답변

0 추천
라디오 버튼에 텍스트라는게 O "텍스트"  이런걸 말씀하시는거죠?

어떤 기능을 구성하시는지 잘 모르겟지만

잘 기억은 안 나지만 xml 에서 라디오버튼옵션에 android:text하면 들어가지 않나요?
브루스웨인 (8,580 포인트) 님이 2013년 10월 11일 답변
phoneAddress 를 직접 선택된 라디오 버튼 위에 뿌리는건데...
getText 해보면 얻어지는 걸로 봐선 뿌려지는것 같긴 한데..
보이지가 않네요.ㅠ
...