私はカスタムステッパーに取り組んでいます。すべてが正常に機能しています。
今やりたいことは、現在のステップを埋めながらステッパーをアニメーション化することです。
この画像は私の考えを示しています:
これは、行、タイトル、およびアイコン src の色を設定する際の私のコードです。
private void DrawStepper(int position) {
switch (position) {
case 0:
imgStepShipper.setImageResource(R.drawable.ic_current_step);
txtStepShipper.setTextColor(getResources().getColor(R.color.colorPrimary));
line.setBackgroundColor(getResources().getColor(R.color.colorDarkWhite));
imgStepConsignee.setImageResource(R.drawable.ic_unselected_step);
txtStepConsignee.setTextColor(getResources().getColor(R.color.colorDarkSuperWhite));
line2.setBackgroundColor(getResources().getColor(R.color.colorDarkWhite));
imgStepShipment.setImageResource(R.drawable.ic_unselected_step);
txtStepShipment.setTextColor(getResources().getColor(R.color.colorDarkSuperWhite));
line3.setBackgroundColor(getResources().getColor(R.color.colorDarkWhite));
imgStepCharges.setImageResource(R.drawable.ic_unselected_step);
txtStepCharges.setTextColor(getResources().getColor(R.color.colorDarkSuperWhite));
break;
case 1:
imgStepShipper.setImageResource(R.drawable.ic_done_step);
txtStepShipper.setTextColor(getResources().getColor(R.color.colorPrimary));
line.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
imgStepConsignee.setImageResource(R.drawable.ic_current_step);
txtStepConsignee.setTextColor(getResources().getColor(R.color.colorPrimary));
line2.setBackgroundColor(getResources().getColor(R.color.colorDarkWhite));
imgStepShipment.setImageResource(R.drawable.ic_unselected_step);
txtStepShipment.setTextColor(getResources().getColor(R.color.colorDarkSuperWhite));
line3.setBackgroundColor(getResources().getColor(R.color.colorDarkWhite));
imgStepCharges.setImageResource(R.drawable.ic_unselected_step);
txtStepCharges.setTextColor(getResources().getColor(R.color.colorDarkSuperWhite));
break;
case 2:
imgStepShipper.setImageResource(R.drawable.ic_done_step);
txtStepShipper.setTextColor(getResources().getColor(R.color.colorPrimary));
line.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
imgStepConsignee.setImageResource(R.drawable.ic_done_step);
txtStepConsignee.setTextColor(getResources().getColor(R.color.colorPrimary));
line2.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
imgStepShipment.setImageResource(R.drawable.ic_current_step);
txtStepShipment.setTextColor(getResources().getColor(R.color.colorPrimary));
line3.setBackgroundColor(getResources().getColor(R.color.colorDarkWhite));
imgStepCharges.setImageResource(R.drawable.ic_unselected_step);
txtStepCharges.setTextColor(getResources().getColor(R.color.colorDarkSuperWhite));
break;
case 3:
imgStepShipper.setImageResource(R.drawable.ic_done_step);
txtStepShipper.setTextColor(getResources().getColor(R.color.colorPrimary));
line.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
imgStepConsignee.setImageResource(R.drawable.ic_done_step);
txtStepConsignee.setTextColor(getResources().getColor(R.color.colorPrimary));
line2.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
imgStepShipment.setImageResource(R.drawable.ic_done_step);
txtStepShipment.setTextColor(getResources().getColor(R.color.colorPrimary));
line3.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
imgStepCharges.setImageResource(R.drawable.ic_current_step);
txtStepCharges.setTextColor(getResources().getColor(R.color.colorPrimary));
break;
}
}
位置は現在のステップです。
これが私のUIです:
私が言ったように、私はステップから別のステップに移動するたびにラインをアニメーション化したいと考えています.
ありがとうございました :)