decimal input filter android
<p>I want to make an EditText to take decimal values where 2 digits after decimal point would be allowed(optional). Values can be:</p>

<p>xxxx</p>

<p>xxxx.x</p>

<p>xx.xx</p>

<p>.xx</p>

<p>.x</p>

<p>x.x</p>

<p>I've tried so many solutions found in S/O and I've found proper regex to meet my solution. But none is fulfilling my requirements. some solution meets requirement but doesn't allow to edit before decimal point. Suppose, when edittext value is .xx then can't edit before decimal point(.).</p>

<p>can anyone point out the proper solution.</p>

<p>N.B.: using maxLength property in EditText.</p>