I would like to have this
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" style="@style/font_size_increase"/>
</selector>
and it seems that this one is not supported anymore.
I wonder if there is another way to increase the text size (in xml) when it is pressed?
Many thanks!
UPDATED CODE-- Create your own dimens.xml file and then set it on selector like this
<resources>
<item name="text_size" type="integer">10dp</item>
</resources>
Then use in java code-
textView.setOnTouchListener( new OnTouchListener() {
@Override
public boolean onTouch( View v, MotionEvent event ) {
switch(event) {
case MotionEvent.ACTION_DOWN:
textView.setTextSize(this.getResources().getDimension(R.id.text_size));
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
}
return false;
}
} );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With