I face a problem when scaling up TextViews and Checkboxes in Samsung GT-N5110 android version 4.1.2 the following image appears after scaling up the TextView there\'s textview i
private int dp2px(float dp){
return (int) (dp * activity.getResources().getDisplayMetrics().density + 0.5f);
}
private doScale(){
final LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.test);
final TextView textView = (TextView) linearLayout.findViewById(R.id.tv_main);
final int oldSize = dp2px(30);
final float scale = 2f;
final float textSizeOld = textView.getTextSize();
ValueAnimator valueAnimatorLarge = ValueAnimator.ofInt(1,100 );
valueAnimatorLarge.setDuration(500);
valueAnimatorLarge.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
ViewGroup.LayoutParams layoutParams = linearLayout.getLayoutParams();
float currentScale = (int)animation.getAnimatedValue()/100f;
layoutParams.width = (int) (scale*oldSize*currentScale);
layoutParams.height = layoutParams.width;
linearLayout.setLayoutParams(layoutParams);
textView.setTextSize(scale*textSizeOld*currentScale);
}
});
valueAnimatorLarge.start();
}