复制代码 代码如下:
<?xml version="1.0" enCoding="utf-8"?>
<linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"
androID:layout_wIDth="match_parent"
androID:layout_height="match_parent"
androID:orIEntation="horizontal"
androID:gravity="center">
<Progressbar
androID:ID="@+ID/progressbar1"
androID:layout_wIDth="wrap_content"
androID:layout_height="wrap_content"
/>
<TextVIEw
androID:ID="@+ID/processhint"
androID:layout_wIDth="wrap_content"
androID:layout_height="wrap_content"
androID:layout_marginleft="10dp"
androID:text="@string/prohint"
androID:textSize="18sp" />
</linearLayout>
因为这个页面的使用平率很高,所以我们把它单独独立出来作为一个XML文件,在AndroID中如果要在布局文件中引入其他布局文件时,方法其实和JsP编程中的Include十分相似哈,具体的格式如下:<include androID:ID="@+ID/layout_process" layout="@layout/processbar" />
下面我们就来说说要怎么实现旋转进程的实现,由于自带的加载样式不好看,我们就需要自定义样式,这时候需要一张png图片,即旋转的进度条。
接下来我们需要定义style文件。process_style.xml(定义在values文件夹下)
复制代码 代码如下:
<?xml version="1.0" enCoding="utf-8"?>
<resources xmlns:androID="http://schemas.androID.com/apk/res/androID">
<style name="process_bar_style">
<item name="androID:indeterminateDrawable">@drawable/processstyle</item>
</style>
</resources>
定义完style文件后,当然还没实现上面的效果,当然我们还要的就是让图片动起来,那么我们就需要自定义的属性动画哈,process.xml,在drawable文件夹下定义
复制代码 代码如下:
<?xml version="1.0" enCoding="utf-8"?>
<animated-rotate xmlns:androID="http://schemas.androID.com/apk/res/androID"
androID:drawable="@drawable/process"
androID:pivotX="50%"
androID:pivotY="50%"
/>
关键的就是这个代码,可以实现图片的自动旋转。
那么大家可以尝试下了哈,自己也能做加载的设计者 总结
以上是内存溢出为你收集整理的Android中自定义加载样式图片的具体实现全部内容,希望文章能够帮你解决Android中自定义加载样式图片的具体实现所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)