我縮放rootView
即的ViewPager
但子視圖不是clickable
。縮放rootview後,子視圖不可點擊
這是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中的視圖不可點擊。我該如何解決這個問題?
這不起任何作用。如果我添加此屬性,那麼它會使頁面不響應點擊事件。 –