Je trouve ce projet https://github.com/LukeDeighton/WheelView dans Github, et je n'arrive pas à réaliser comment régler différents éléments à différentes positions dans WheelView. Je veux ajouter deux éléments (Liste ArrayList) Qui peut m'arrêter s'il vous plaît ??Comment régler les éléments de wheelView
Ceci est mon code:
public class MainActivity extends AppCompatActivity {
private WheelView wheelView;
private ArrayList<Drawable> list;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//This is the items I want to add
list = new ArrayList<>();
list.add(getResources().getDrawable(R.drawable.loader));
list.add(getResources().getDrawable(R.drawable.twitter));
////
wheelView = (WheelView) findViewById(R.id.wheelView);
wheelView.setAdapter(new WheelAdapter() {
@Override
public Drawable getDrawable(int position) {
return ...;
}
@Override
public int getCount() {
return (int)wheelView.getItemCount();
}
@Override
public Object getItem(int position) {
return 0;
}
});
}
}
C'est le xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.roashviz.giftest2.MainActivity">
<com.lukedeighton.wheelview.WheelView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/wheelView"
app:wheelColor="@color/colorAccent"
app:rotatableWheelDrawable="true"
app:selectionAngle="270.0"
app:wheelPosition=""
app:wheelOffsetY="0dp"
app:repeatItems="true"
app:wheelRadius="150dp"
app:wheelItemCount="2"
app:wheelPadding="13dp"
app:wheelItemRadius="43dp"
android:layout_alignParentBottom="true" />
Thank You !! :)
Vous voulez dire le code nécessaire dans WheelView Adapter $ getDrawable? –