2016-10-22 34 views
0

我想使用drawableRightEditText作爲某些東西的定位視圖。
但是沒有任何方法可以獲得drawableRight使用EditText的drawableRight作爲定位點

有沒有辦法做到這一點?

+1

'editText.getCompoundDrawables()[2]'獲取當前右繪製。 –

回答

0

編程:

edt.setCompoundDrawablesRelativeWithIntrinsicBounds(0, R.drawable.ic_right, 0, 0); 

edt.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(android.R.drawable.ic_right), null); 

XML:

android:drawableRight="@drawable/ic_right"