Я пытаюсь изменить высоту RelativeLayout как пользовательские свитки, поэтому он плавно перемещается вверх. Это своего рода работа, но все это мерцает и сжимается.Изменить RelativeLayout height как пользовательские прокрутки в scrollview
Я попытался использовать setTranslationY, но это не перемещает scrollview с RelativeLayout.
int top = mScrollView.getScrollY();
int maxRelative = formulas.dpToPx(250);
int actualRelative = (int)((1.0-((float)top)/300.0)*((float)maxRelative));
RelativeLayout.LayoutParams layout_description = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
actualRelative);
mCollapsingLayout.setLayoutParams(layout_description);
mCollapsingLayout.requestLayout();
Вот как это выглядит
Если у вас есть какие-либо лучшее представление о том, как уменьшить RelativeLayout при прокрутке, его оценили.
Edit: вот мой XML
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:id="@+id/collapsing.view">
<ImageView
android:id="@+id/collapsing.view.image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/theflash"
android:tint="#7F000000"
android:scaleType="centerCrop"/>
<ImageButton
android:id="@+id/favorite.button"
android:layout_width="70dp"
android:layout_height="70dp"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="30dp"
android:src="@drawable/favorite_button"
/>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:paddingBottom="30px">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="The Flash"
android:textColor="#fff"
android:textSize="25sp"
android:layout_centerInParent="true"
/>
</FrameLayout>
</RelativeLayout>
<ScrollView
android:id="@+id/detail.scrollview"
android:layout_below="@+id/collapsing.view"
android:layout_width="match_parent"
android:fillViewport="true"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</ScrollView>
Вы можете использовать файл XML макет? – Alex
Да, его в главном сообщении сейчас :) – Bartando
Вы пытаетесь изменить размер всего 'collapsing.view' или пытаться добавить эффект параллакса к изображению? – Alex