使用shape图形资源制作引导页面的提示圆点
来源:互联网 发布:php手机板块 编辑:程序博客网 时间:2024/05/21 02:21
在app引导界面通常有引导界面提示小圆点,下面简单介绍一下利用shape图形资源如何实现:
本文引导界面是使用的ViewPager,当ViewPager滑动时候可以动态的改变小圆点的颜色来提示用户
1,在res文件夹下面创建子文件夹drawable,分别有两个shape图形资源,一个是默认时候,一个是选中时候
a,默认时候的shape资源:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <solid android:color="@color/defalut" /> <corners android:radius="15dp"/></shape>b,选中时候的shape资源:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <solid android:color="@color/blue" /> <corners android:radius="15dp"/></shape>
2,在xml中定义一个Linearlayout存放ImageView即小圆点
<pre name="code" class="html"> <LinearLayout android:layout_marginTop="5dp" android:id="@+id/ll_search" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:orientation="horizontal" > <ImageView android:layout_marginLeft="5dp" android:layout_width="15dp" android:layout_height="15dp" android:background="@drawable/guide_dot_select" /> <ImageView android:layout_marginLeft="5dp" android:layout_width="15dp" android:layout_height="15dp" android:background="@drawable/guide_dot_nomal" /> <ImageView android:layout_marginLeft="5dp" android:layout_width="15dp" android:layout_height="15dp" android:background="@drawable/guide_dot_nomal" /> <ImageView android:layout_marginLeft="5dp" android:layout_width="15dp" android:layout_height="15dp" android:background="@drawable/guide_dot_nomal" /> </LinearLayout>
3,代码中实现:ViewPager滑动时候改变圆点颜色
mViewPager.addOnPageChangeListener(new OnPageChangeListener() {@Overridepublic void onPageSelected(int position) {// TODO Auto-generated method stubfor (int i = 0; i < ll_search.getChildCount(); i++) {if (i == position) {ll_search.getChildAt(i).setBackgroundResource(R.drawable.guide_dot_select);} else {ll_search.getChildAt(i).setBackgroundResource(R.drawable.guide_dot_nomal);}}}@Overridepublic void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {// TODO Auto-generated method stub}@Overridepublic void onPageScrollStateChanged(int state) {// TODO Auto-generated method stub}});
1 0
- 使用shape图形资源制作引导页面的提示圆点
- shape图形的使用
- Drawable资源--Shape的使用
- Android之的Shape图形使用
- Android自定义图形-Shape的使用
- Shape的使用---带色的圆点
- AndroidUI 引导页面的使用
- selector和shape静态资源的使用
- drawable自定义图形资源之shape属性
- 使用GRUB2制作简单的系统引导
- iOS 引导页的制作和使用
- 强大的SHAPE资源
- app的引导页面的使用
- 初次启动App进入引导页面自定义圆点的实现
- 智慧北京:引导页面静态点的添加
- 智慧北京:引导页面动态点的实现
- ViewPager实现APP的引导页面(小圆点联动)
- android 半透明图层用户引导、用户指导、用户教导,教用户怎么使用app的页面制作
- 【CERC2012】【BZOJ4059】Non-boring sequences
- 矩阵的转置
- Android 内存泄漏总结
- MySql主从复制的简单实现
- 个人办公常用工具
- 使用shape图形资源制作引导页面的提示圆点
- 再学习Java——一些我们可能忽略的东西(1)
- 使用Eclipse将Android项目打Library包
- [IOS 开发] 使用UIVisualEffectView实现模糊效果
- EditText输入数据精确到小数点后n位
- Block的那些事
- MTP in Android详解
- LeetCode #100 Same Tree
- 用AFNetworking3.0封装网络请求