1
有三个图标。我把图标放在整数数组上。我该如何给他们点击监听器事件。 icon0,icon1,icon2事件不同。我想给他们点击事件。但我做不到。我怎样才能单独给点击事件图标将clickEvent添加到int数组
我用wheel.gama jar和这个图标不在xml中。他们在可绘制的文件夹
package com.myproject.gama;
import java.util.Arrays;
import com.digitalaria.gama.wheel.Wheel;
import com.digitalaria.gama.wheel.WheelAdapter;
import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;
import android.view.View.*;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ImageView;
import android.util.Log;
public class SampleWheelActivity extends Activity {
private static final String TAG = SampleWheelActivity.class.getSimpleName();
private Wheel wheel;
public WheelAdapter<Adapter> adapter;
private Resources res;
public int[] icons = {
R.drawable.icon1, R.drawable.icon0 , R.drawable.icon2};
ImageView t;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
init();
}
private void init() {
res = getApplicationContext().getResources();
wheel = (Wheel) findViewById(R.id.wheel);
wheel.setItems(getDrawableFromData(icons));
wheel.setWheelDiameter(400);
}
@Override
public void onResume(){
for (int i = 0; i < icons.length; i++) {
t= new ImageView(SampleWheelActivity.this);
t.setId(i);
t.setOnClickListener((OnClickListener) this);
super.onResume();
}
}
我能否改变它的ImageView – 19052013
和哪能事件监听器设置为轮.. :( – 19052013
例如添加为您初始化方法 – Christian