2017-05-10 2 views
0

ListView에서 값의 행 색상을 설정합니다. 지금은이 문자열, 아니 모든 행 색을 설정하려는ListView에서 텍스트의 색을 설정하는 방법

ListAdapter adapter = new SimpleAdapter(MainActivity.this, DevicesList, 
        R.layout.list_item, new String[]{"name", "clients", "stan"}, 
        new int[]{R.id.name, R.id.clients, enabled}){ 
       @Override 
       public View getView(int position, View convertView, ViewGroup parent) { 
        View view = super.getView(position, convertView, parent); 
        TextView v = (TextView) view.findViewById(R.id.enabled); 
        String a = v.getText().toString(); 

        if (a == "Aktywny") { 
         view.setBackgroundColor(Color.argb(125,53,104,45)); 
        } else if(a == "Nieaktywny") { 
         view.setBackgroundColor(Color.argb(125,175,43,30)); 
        } else{ 
         view.setBackgroundColor(Color.argb(125,139,140,122)); 
        } 

        return view; 
       } 
      }; 
+1

[안드로이드 ListView에 텍스트 색상] (의 가능한 중복 http://stackoverflow.com/questions/4533440/android-listview-text-color) –

답변

0
v.setTextColor(Color.argb(125,175,43,30)) 
+0

정말 고마워요. – Torwopik

관련 문제