1

I have a preference, to be used as settings of my application. I want to change the background color of a particular item in listpref (listview). I used the code below:

    Drawable background = getResources().getDrawable(R.drawable.bg_barcode_des);
    addPreferencesFromResource(R.xml.admin_preferences);
    Preference credentials = findPreference("demo");
    View credentialsView = credentials.getView(null, null);
    credentialsView.setBackgroundDrawable(background);

    //**OR** credentialsView.setBackground(background);
    //**OR** credentialsView.setBackgroundColor(Color.RED);
    //Non of these or working...

But nothing change in my preference activity. Any correction that I need to do???

pkverma
  • 21
  • 4

0 Answers0