要實現Android TextView滾動到特定位置,您可以使用以下方法:
smoothScrollTo()
方法來滾動到特定位置。例如:ScrollView scrollView = findViewById(R.id.scrollView);
TextView textView = findViewById(R.id.textView);
int scrollToY = 100; // 滾動到的位置
scrollView.smoothScrollTo(0, scrollToY);
scrollTo()
方法:直接使用TextView的scrollTo()
方法來滾動到特定位置。例如:TextView textView = findViewById(R.id.textView);
int scrollToY = 100; // 滾動到的位置
textView.scrollTo(0, scrollToY);
smoothScrollTo()
方法來實現滾動到特定位置。例如:NestedScrollView nestedScrollView = findViewById(R.id.nestedScrollView);
TextView textView = findViewById(R.id.textView);
int scrollToY = 100; // 滾動到的位置
nestedScrollView.smoothScrollTo(0, scrollToY);
通過以上方法,您可以實現Android TextView滾動到特定位置的功能。