setCompoundDrawablesWithIntrinsicBounds(int,int,int,int) not working

android, android-drawable, android-edittext, graphics, xml

Solution

If anyone else has this seemingly unexplainable issue then try the following:

- Go to your XML template.

- Remove the XML image representing it.

- Your view should refresh the compounddrawable.

basically this portion of the view does not seem to get reinflated on ICS devices. Hopefully this solves the problem for some people!

Problem

I have a few `EditText views` where I want to set the image on the left and `setCompoundDrawablesWithIntrinsicBounds` does not seems to be working. The graphics do not seem to be getting changed. does anyone know why this might be the case? Here is how I am setting the drawables: ``` mFirstname.setCompoundDrawablesWithIntrinsicBounds(R.drawable.user_icon, 0, 0, 0); mLastname.setCompoundDrawablesWithIntrinsicBounds(R.drawable.user_icon, 0, 0, 0); mEmail.setCompoundDrawablesWithIntrinsicBounds(R.drawable.mailicon, 0, 0, 0); mPassword.setCompoundDrawablesWithIntrinsicBounds(R.drawable.lockicon, 0, 0, 0); mDateOfBirth.setCompoundDrawablesWithIntrinsicBounds(R.drawable.calico, 0, 0, 0); mCity.setCompoundDrawablesWithIntrinsicBounds(R.drawable.mailicon, 0, 0, 0); mStreet.setCompoundDrawablesWithIntrinsicBounds(R.drawable.mailicon, 0, 0, 0); mPostcode.setCompoundDrawablesWithIntrinsicBounds(R.drawable.mailicon, 0, 0, 0); mPhoneNumber.setCompoundDrawablesWithIntrinsicBounds(R.drawable.mailicon, 0, 0, 0); ```

Original source