Android-PhoneGuardian之启动界面
来源:互联网 发布:hadoop tensorflow 编辑:程序博客网 时间:2024/06/05 16:09
今天我们看下一个简单的app启动界面,界面十分简单,只有一张图片和一个进度条。直接上图了。
创建一个新的工程,然后修改启动Activity为SplashActivity,创建好的工程如下
由于只是做简单的页面布局,不涉及代码实现,所以我们直接看下这个启动界面的布局。
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" tools:context="com.easygoings.phoneguardian.SplashActivity"> <ImageView android:id="@+id/iv_bg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginLeft="30dp" android:layout_marginRight="30dp" android:src="@drawable/logo"></ImageView> <ProgressBar android:id="@+id/pb_progress" android:layout_width="wrap_content" android:layout_height="wrap_content" android:indeterminateDrawable="@drawable/pb_progress"/></LinearLayout>
布局很简单,是一个线性布局框架,然后里面有一个ImageView来显示logo图片,另外有一个ProgressBar来显示加载进度条。
代码很容易看懂,值得说的是可能作为刚接触android来说,对其中的属性比较陌生,望文生义,这里就只说一下android:indeterminateDrawable 这个属性设置绘制不显示进度的进度条的Drawable对象。
在资源文件里创建pb_progress.xml来定制我们想要的样子。
<?xml version="1.0" encoding="utf-8"?><animated-rotate xmlns:android="http://schemas.android.com/apk/res/android" android:pivotX="50%" android:pivotY="50%" android:fromDegrees="0" android:toDegrees="360"> <shape android:shape="ring" android:innerRadiusRatio="3" android:thicknessRatio="8" android:useLevel="false"> <gradient android:type="sweep" android:useLevel="false" android:startColor="#6BD3FF" android:centerColor="#FF7121" android:centerY="0.50" android:endColor="#FFFF00" /> </shape></animated-rotate>
看名字大概就可以知道这是动画旋转相关的。让我们看下其中的参数:
android:fromDegrees 起始的角度度数 android:toDegrees 结束的角度度数,负数表示逆时针,正数表示顺时针。如10圈则比android:fromDegrees大3600即可 android:pivotX 旋转中心的X坐标 浮点数或是百分比。浮点数表示相对于Object的左边缘,如5; 百分比表示相对于Object的左边缘,如5%; 另一种百分比表示相对于父容器的左边缘,如5%p; 一般设置为50%表示在Object中心 android:pivotY 旋转中心的Y坐标 浮点数或是百分比。浮点数表示相对于Object的上边缘,如5; 百分比表示相对于Object的上边缘,如5%; 另一种百分比表示相对于父容器的上边缘,如5%p; 一般设置为50%表示在Object中心 android:duration 表示从android:fromDegrees转动到android:toDegrees所花费的时间,单位为毫秒。可以用来计算速度。
shape用来定义需要显示的形状,
gradient: 设置形状的渐变颜色,可以是线性渐变、辐射渐变、扫描性渐变
- android:type 渐变的类型
- linear 线性渐变,默认的渐变类型
- radial 放射渐变,设置该项时,android:gradientRadius也必须设置
- sweep 扫描性渐变
- android:startColor 渐变开始的颜色
- android:endColor 渐变结束的颜色
- android:centerColor 渐变中间的颜色
- android:angle 渐变的角度,线性渐变时才有效,必须是45的倍数,0表示从左到右,90表示从下到上
- android:centerX 渐变中心的相对X坐标,放射渐变时才有效,在0.0到1.0之间,默认为0.5,表示在正中间
- android:centerY 渐变中心的相对X坐标,放射渐变时才有效,在0.0到1.0之间,默认为0.5,表示在正中间
- android:gradientRadius 渐变的半径,只有渐变类型为radial时才使用
- android:useLevel 如果为true,则可在LevelListDrawable中使用
阅读全文
0 0
- Android-PhoneGuardian之启动界面
- Android之启动界面之Splash总结
- Android APP ---Mr Expense 之 启动界面
- Android小记:之启动界面---Splash
- Android启动界面之SplashActivity的设计
- Android启动界面之ViewPager用法详解
- Android手机安全卫视之启动界面
- IOS之启动界面
- 定制android启动界面
- 定制android启动界面
- 定制android启动界面
- 定制android启动界面
- android启动界面说明
- 创建Android启动界面
- android启动界面
- 创建Android启动界面
- 创建Android启动界面
- 创建Android启动界面
- 注意!这6种行为会让自己的征信“招黑”
- js笔记——call,apply
- mips汇编程序中的.set指令使用
- EXCEL编程经验总结
- 如何用webstrom打开anjular2项目
- Android-PhoneGuardian之启动界面
- Java第二章练习习题
- 如何使用pv命令监控Linux命令的执行进度
- 动态库的创建和调用
- java基础复习三:i++与++i以及表达式
- HDOJ 1555 How many days?
- java 自我知识总结(七) 冒泡排序法
- Mybatis问题-----There is no getter for property named 'productCode' in 'class java.lang.Strin g'
- hadoop,sparksql学习过程中遇到的报错及解决方法