vovahost
vovahost

Reputation: 36007

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?

Upvotes: 8

Views: 913

Answers (1)

Raymond Yeung
Raymond Yeung

Reputation: 111

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)

Upvotes: 11

Related Questions