나는 각 바퀴에 단어가있는 4 개의 바퀴 선택 도구가 있습니다. 현재 문제는 각 바퀴가 동일한 단어로 당겨져 아래 코드를 볼 수 있다는 것입니다.Android 휠 어레이 반 작업
제 질문은 누군가 각 바퀴에 단어 배열을 제공하는 데 도움이 될 수 있습니까? 아래 XML에서 각 휠에는 자체 ID가 있지만 자바에서 사용하는 방법을 알아낼 수 없으므로 각 휠마다 고유 한 배열이 있습니다.
private void initWheel(int id) {
WheelView wheel = getWheel(id);
wheel.setViewAdapter(new ArrayWheelAdapter<String>(this, new String[]{"Abc", "Foo", "Bar"}));
wheel.setCurrentItem((int)(Math.random() * 10));
wheel.addChangingListener(changedListener);
wheel.addScrollingListener(scrolledListener);
wheel.setCyclic(true);
wheel.setInterpolator(new AnticipateOvershootInterpolator());
}
private WheelView getWheel(int id) {
return (WheelView) findViewById(id);
}
내 XML은
<kankan.wheel.widget.WheelView
android:id="@+id/passw_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<kankan.wheel.widget.WheelView
android:id="@+id/passw_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<kankan.wheel.widget.WheelView
android:id="@+id/passw_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<kankan.wheel.widget.WheelView
android:id="@+id/passw_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
답해 주셔서 감사합니다.하지만 구현 방법을 이해하지 못해서 조금 더 자세히 도와 줄 수 있습니까? 감사. – Matt
더 자세한 내용은 원래 대답을 –
추가했습니다. 덕분에 지금은 어떻게 작동 해야하는지 볼 수 있지만 단어 "값"이 오류 "값을 해결할 수"얻을 코드를 변경할 때 볼 수있는 위치를 iniWheel 오류가 발생하지 않고 이동하십시오. – Matt