Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EditText: how to set clipToPadding to false

I have a scrollable EdiText with padding but as you know, when you scroll the text inside the EditText, it gets clipped off by the padding instead of overlapping it.

The EditText doesn't have the clipToPadding option. Is there a way to mimic clipToPadding="false" feature which is available in the ViewGroup?

like image 211
vovahost Avatar asked Sep 01 '17 17:09

vovahost


1 Answers

This is a bit hacky, but you can add a transparent shadow with a shadow radius equal to the bottom padding.

e.g.

editText.setShadowLayer(editText.extendedPaddingBottom.toFloat(), 0f, 0f, Color.TRANSPARENT)
like image 70
Raymond Yeung Avatar answered Nov 15 '22 07:11

Raymond Yeung