Android - Textview change color on changing of state

后端 未结 5 2010
滥情空心
滥情空心 2020-11-30 11:14

How can I apply color on the various states(focused, pressed, enabled) of the TextView?

I have already referred this: http://developer.android.com/reference/android/

5条回答
  •  甜味超标
    2020-11-30 11:37

    textView = (TextView)findViewById(R.id.myTextView);
    mMainView.setOnClickListener(new OnClickListener(){
    
        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            textView.setTextColor(Color.GREEN);//set the color here
        }
    
    });
    

提交回复
热议问题