Fix TextView#setTextCursorDrawable for resid=0
The CL fixes TextView#setTextCursorDrawable, for the case when a zero drawable resource id is passed. We want to set a null Drawable, but the Context#getDrawable(0) call was throwing rather than returning null. Bug: 122742983 Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest Change-Id: I45bf57002043d7dbe541d76e61fce3f729959fc8
This commit is contained in:
@@ -3685,7 +3685,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
* @attr ref android.R.styleable#TextView_textCursorDrawable
|
||||
*/
|
||||
public void setTextCursorDrawable(@DrawableRes int textCursorDrawable) {
|
||||
setTextCursorDrawable(mContext.getDrawable(textCursorDrawable));
|
||||
setTextCursorDrawable(
|
||||
textCursorDrawable != 0 ? mContext.getDrawable(textCursorDrawable) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user