0
私は視差効果を作成します。画像の背景を移動するのは、リサイクラビューの最初の要素の位置のみに依存します。Reyclerビューとカスタム視差効果
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if ((holder = recyclerView.findViewHolderForAdapterPosition(0)) != null) {
int offset = recyclerView.findViewHolderForAdapterPosition(0).itemView.getTop()/10;
backgroundPhoto.setTop(offset);
}
問題がある:リサイクル(ヘッダ)の最初の項目が画面の外にスクロールするとき、背景画像が何らかの形OT初期位置をジャンプ。
実際にバックグラウンドの "ジャンプ" setTop関数が呼び出されなかったとき。背景画像の位置を変えることができるものは何ですか? –