【发布时间】:2017-12-17 18:47:12
【问题描述】:
我正在缩放rootView,即LinearLayout 中的fragment ViewPager,但子视图不是clickable。
这是rootView
public class CarouselLinearLayout extends LinearLayout {
private float scale = CarouselPagerAdapter.BIG_SCALE;
public CarouselLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CarouselLinearLayout(Context context) {
super(context);
}
public void setScaleBoth(float scale) {
this.scale = scale;
this.invalidate();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// The main mechanism to display scale animation, you can customize it as your needs
int w = this.getWidth();
int h = this.getHeight();
h = h - ((h / 2) / 2) / 2;
canvas.scale(scale, scale, w / 2, h);// / 2
}
}
这是我缩放rootview的相关代码。
LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.pager_fragment_dashboard, container, false);
CarouselLinearLayout root = (CarouselLinearLayout) linearLayout.findViewById(R.id.root_container);
root.setScaleBoth(scale);
就是这个样子。
每个圆圈都是PagerView的页面。 1 - 2 - 3
第 2 页中的视图可点击,但第 1 页和第 3 页中的视图不可点击。我该如何解决这个问题?
【问题讨论】:
标签: java android android-viewpager android-animation android-view