2012-04-22 2 views
0

클릭하면 내 textview의 색상을 변경하고 싶습니다.클릭시 Textview의 색상 변경

사실,이 XML 코드가 있습니다.

<TextView 
    android:id="@+id/textView1" 
    android:autoLink="web" 
    android:duplicateParentState="true" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignBottom="@+id/button_modif" 
    android:layout_alignParentLeft="true" 
    android:layout_alignTop="@+id/button_modif" 
    android:text="Informations personnelles:" 
    android:textColor="#00A9A9" 
    android:textSize="7pt" 
    android:textStyle="bold" /> 

목표를 달성하려면 어떻게해야합니까? 사전에

덕분에

감사

답변

0

무엇을하기를 변경 하시겠습니까? 그 안에있는 텍스트의 색상이나 텍스트 뷰의 배경색은 무엇입니까?

당신은 배경의 색상을 변경하려면, 당신이 사용할 수

tv.setOnClickListener(new View.OnClickListener() { 

     public void onClick(View v) { 
      // TODO Auto-generated method stub 
      tv.setBackgroundColor(Color.WHITE); 
     } 
    }); 

하지만 당신은 텍스트 색상을 변경하려면, 이것을 사용,

tv.setOnClickListener(new View.OnClickListener() { 

     public void onClick(View v) { 
      // TODO Auto-generated method stub 
      tv.setTextColor(Color.BLACK); 
     } 
    }); 

나는 그것을 희망 도움이됩니다.