У меня есть список, содержащий 10 строк. Каждая строка имеет текстовое представление, и когда я пытаюсь добавить анимацию fade_out в самом тексте, анимации происходят только с последним элементом списка. Я хочу сделать это во всех дочерних текстах.Добавление анимации в textview дочерний элемент списка в строке
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater in=getLayoutInflater();
View row=in.inflate(R.layout.row_main, parent,false);
titr=(TextView) row.findViewById(R.id.row_main_titr);
matn=(TextView) row.findViewById(R.id.row_main_content);
TextView extra=(TextView) row.findViewById(R.id.row_main_extra);
ImageView image=(ImageView) row.findViewById(R.id.row_main_image);
titr.setHorizontallyScrolling(true);
//titr.setMovementMethod(new ScrollingMovementMethod());
//titr.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET);
ViewGroup.LayoutParams paramsi = image.getLayoutParams();
paramsi.height= (W/2)-10;
//image.setScaleType(ImageView.ScaleType.CENTER_CROP);
image.setLayoutParams(paramsi);
image.setImageBitmap(img[position]);
titr.setTextSize((float)W/35);
titr.setText(name[position]);
matn.setText(Html.fromHtml(content[position]).toString().replace("•", "\n"));
extra.setText("نظرها: "+commentcount[position]);
titr.setTypeface(yekan);
matn.setTypeface(yekan);
extra.setTypeface(MainActivity.koodak);
return (row);
}
}
и здесь я хочу, чтобы добавить анимацию
// ShakeDetector initialization
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mShakeDetector = new ShakeDetector(new OnShakeListener() {
@Override
public void onShake() {
final Animation out = AnimationUtils.loadAnimation(getBaseContext(), android.R.anim.fade_out);
out.setDuration(300);
out.setFillAfter(true);
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "tekun bede", Toast.LENGTH_LONG).show();
}
});
его настолько важно для меня, чтобы использовать senso в другом классе –
Нет в классе адаптера, но создайте новый объект для каждого вида. – fsebek