j'ai fait comme ça,
final ScrollView mScrollView = (ScrollView) findViewById(R.id.scrollview);
layoutSponsorBax.setVisibility(View.VISIBLE);
Timer timer = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
ViewGroup relativeL = (ViewGroup) mScrollView
.getChildAt(mScrollView.getChildCount() - 1);
final int sVH = mScrollView.getBottom()
- mScrollView.getTop();
View notePad = relativeL.getChildAt(2);
final int svHeight = 800;
Log.i("svHeight", "svHeight : " + svHeight);
final float duration = 2000;
ctt = new CountDownTimer((int) duration, 1) {
int temp = 0;
public void onTick(long millisUntilFinished) {
try {
Log.i("millisUntilFinished",
"millisUntilFinished : "
+ millisUntilFinished);
Log.i("Height- Temp", "Temp : " + temp);
mScrollView.scrollTo(0, temp);
temp = (int) (((svHeight) - (millisUntilFinished/duration)
* (svHeight)));
} catch (ArithmeticException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
public void onFinish() {
}
}.start();
}
});
}
};
int duration = 1400;
timer.schedule(task, duration);
s'il vous plaît vérifier cela, il peut être utile pour vous
Je ne sais pas, mais pouvez-vous utiliser 'onScrollChanged'? [référence] (http://stackoverflow.com/a/1800267/1777090) –
@PurpleDroid Oui, je peux. Mais peut-être existe-t-il un moyen plus facile? :) –
Ok :) pas au courant alors :) –