我希望将带有Scroll的ScrollChoise数字立即传输到TextView。set to 3
scroll to 4
set to 4
public class HomeFragment extends Fragment {
TextView textView;
// int [] data=new int[10];
List<String> datas = new ArrayList<>();
ScrollChoice scrollChoice1;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_home, container, false);
scrollChoice1 = v.findViewById(R.id.scroll_choice1);
textView = v.findViewById(R.id.summTextView);
loadDatas();
scrollChoice1.addItems(datas, 2);
scrollChoice1.setOnItemSelectedListener(new ScrollChoice.OnItemSelectedListener() {
@Override
public void onItemSelected(ScrollChoice scrollChoice, int position, String name) {
textView.setText(name);
}
});
return v;
}
private void loadDatas() {
datas.add("1");datas.add("2");datas.add("3");datas.add("4");datas.add("5");datas.add("6");datas.add("7");datas.add("8");datas.add("9")
}
当我滚动ScrollView时,会稍有延迟,因此必须从ScrollView中移开手指来更新数字。 如何进行即时切换?