Android TextView background does not move when TextView.Padding changes
I have a TextView that I created in main.xml. In my app.java, I dynamically position the TextView based on where the user takes the screen. The problem I'm running into is that when I call myTextView.setPadding (100,100,0,0), it moves the actual TextView text, but doesn't move the color background of the TextView.
Ideas?
+2
a source to share
3 answers
You can use animation to move the view.
Animation a = new TranslateAnimation((oldPos),
newPos, 0.0f, 0.0f);
a.setDuration(300);
a.setStartOffset(100);
a.setRepeatMode(Animation.ABSOLUTE);
a.setFillAfter(true);
a.setInterpolator(AnimationUtils.loadInterpolator(this.getContext(),
android.R.anim.accelerate_decelerate_interpolator));
View.startAnimation(a);
0
a source to share