我有一个ImageView作为RelativeLayout中的白色蒙版。
当我滑动布局时,白色蒙版也被移动了。
如下所示显示链接...
https://drive.google.com/open?id=193ZK7y7hrc18fYX6E4eYZR1iFVBkkVoC
如何固定蒙版并仅在布局中滑动图标?
任何帮助都非常感谢。
这是我的代码。
private void setPersonIcon() {
LayoutInflater inflater = LayoutInflater.from(this);
@SuppressLint("InflateParams") FrameLayout layout = (FrameLayout)inflater.inflate(R.layout.layout_person_thumbnail, null, false);
ImageView imageViewIcon = (ImageView)layout.getChildAt(0);
imageViewIcon.setImageResource(R.drawable.sample);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
params.setMarginStart(getResources().getDimensionPixelSize(R.dimen.gap_icons_persons));
layout.setLayoutParams(params);
mLayoutPersonIcons.addView(layout);
}
这是我的XML。
<HorizontalScrollView
android:id="@+id/scrollViewPersonIcons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
android:foreground="@drawable/image_mask_white_person_icons">
<LinearLayout
android:id="@+id/layoutPersonIcons"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</LinearLayout>
</HorizontalScrollView>