2011-11-06 19 views

回答

1

您必須爲每一行使用setOnFocusChangedListener()。並訪問您的textViews,並更改文字顏色。

row.setOnFocusChangedListener(focuschangedListener); 

private onFocusChangedListener focustchangedListener = new onFocusChangedListener(

      @Override 
      public void onFocusChange(View row, boolean arg1) { 

       //get access to textviews using row.findViewById() 

       if (arg1) { 
        // view is on focus, change the textcolor 

       } else { 
        // view lost focus, change the text colors to normal. 
       } 
      } 

); 
0

如果你在你的代碼列表視圖設置適配器然後覆蓋getView適配器的是這樣的:

adapter = new ArrayAdapter<String>(YourActivity.this , R.layout.liststylelayout) 
{ 

       @Override 
       public View getView(int position, View convertView,ViewGroup parent) 
       { 
        View v = super.getView(position, convertView, parent); 
        //v is parent view which has your textview as child 
        TextView tv1 =(TextView)v.findViewById(R.id.movielistitemstrings);   
        //get your textview like this    
        tv1.setTextColor(Color.parseColor("#FF8000"));  
        //do your operations on textview     
       }     
}; 
相關問題