触发:
用ViewPager的时候,需要在滑动的一个画面做一个按钮,点击按钮的时候要换颜色且按钮有圆角,所以用selector+Shape做,但是在xml中引用selector时,
<LinearLayout android:layout_width="match_parent" android:layout_marginTop="15dp" android:layout_height="0dp" android:layout_weight="1" > <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/guide_page2_btn_selector" android:text="立即体验" /> </LinearLayout>
只要在这里引用到selector是就会报错
找了好久没有发现问题,百度了一下,原来是
android布局太深导致的 java.lang.StackOverflowError
5.自定义布局
详细见:http://www.cnblogs.com/felix-hua/archive/2012/01/06/2314963.html
上面资料参考网址:http://www.cnblogs.com/shaweng/archive/2012/06/13/2547230.html
所以我只要不用只要我不在xml里面引用selector就不会出错,也出不了想要的效果。
最后使用点击事件做这个效果,或者按钮用图片代替,图片能做切换
个人觉得:ViewPager里面的view不能使用selector.