【发布时间】:2013-12-06 12:04:00
【问题描述】:
我有几个EditText views 想在左侧设置图像,而setCompoundDrawablesWithIntrinsicBounds 似乎不起作用。图形似乎没有改变。
有人知道为什么会这样吗?
这是我设置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);
【问题讨论】:
-
我在使用单选按钮时遇到了同样的问题。调用根本没有效果,图像总是出现在按钮的右侧。你找到解决办法了吗?
-
是的!我做到了。抱歉迟了一个星期才回复。所以它似乎会影响带有 ICS 的设备。解决方案发布在下面
-
下面是什么意思?? @user Denis Glakiy 发布的解决方案?
标签: android xml graphics android-edittext android-drawable