2012-09-10 6 views
0

내 게임에 높은 점수 activity을 만들었습니다. 나는 점수의 산출을 위해 테이블 ​​행을 사용했다. 내 질문은 어떻게 내가 출력을 볼 수 없기 때문에 내 테이블 행의 글꼴 색상을 변경할 수 있습니다.테이블 행 글꼴 색상 변경

<TableLayout 
     android:id="@+id/data_table" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:visibility="invisible" 
     > 

     <TableRow android:visibility="invisible" > 

      <TextView 
       android:layout_marginLeft="65dp" 
       android:visibility="invisible" 
       android:text="#" 
       android:textColor="#000000" /> 


      <TextView 
       android:visibility="invisible" 
       android:text="Score" 
       android:textColor="#000000" /> 


      <TextView 
       android:visibility="invisible" 
       android:text="Player" 
       android:textColor="#000000" /> 

     </TableRow> 
    </TableLayout> 

가 여기에 높은 점수를 activity 내 출력의 색이다 :

여기 내 레이아웃 코드입니다.

enter image description here

어떻게 검은 색에 회색 하나를 변경 것인가? 프로그래밍 방식으로 TextView의를 만들 때 안드로이드는 기본 (회색) 색상을 사용하기 때문에 당신은 텍스트 색상을 할당 할 필요가 사전

+0

테이블 행을 추가하는 방법을 보여줄 수 있습니까? – Eric

+0

코드를 추가했습니다. 감사합니다. –

답변

0

{ 
      TableRow tableRow= new TableRow(this); 

      ArrayList<Object> row = data.get(position); 

      TextView idText = new TextView(this); 
      idText.setText(row.get(0).toString()); 
      tableRow.addView(idText); 


      TextView textOne = new TextView(this); 
      textOne.setText(row.get(1).toString()); 
      tableRow.addView(textOne); 

      TextView textTwo = new TextView(this); 
      textTwo.setText(row.get(2).toString()); 
      tableRow.addView(textTwo); 

      dataTable.addView(tableRow); 
     } 

감사 : 여기

내가 테이블을 추가하는 방법 그렇지 않으면. 검은 색은 0xFF000000입니다. 당신이 다른 TextView들과 그 일관성 유지하기 위해 이에 대한 use a color resource 할 수 있습니다

TextView textOne = new TextView(this); 
textOne.setTextColor(0xFF000000); 
textOne.setText(row.get(1).toString()); 
tableRow.addView(textOne); 

참고.

+0

감사합니다! 도와 줘서 고마워. –