android 加载数据或提交数据时显示转圈的提示页面

本文探讨了Android活动中如何在加载数据或提交数据时显示旋转指示器,同时详细介绍了如何处理软键盘与主窗口的交互,包括软键盘的隐藏/显示控制以及是否调整活动窗口大小以适应软键盘的空间需求。
摘要由CSDN通过智能技术生成
android 加载数据或提交数据时显示转圈的提示页面

       提前声明一下,本博客全是自己的理解,如果内容中有理解错误的地方,欢迎指正。另外,博客内容有参考其他博客,本博客只用来学习。

       当我们进入到一个页面时,通常先会出现一个转圈的dialog,这是因为这个页面需要加载数据,为了防止数据加载完成前空白的页面,通常会先显示转圈的dialog,直到数据加载完成,圈消失。那么,这个转圈的dialog是怎么实现的呢?

      首先,先写 显示转圈的layout:progress_hud.xml
        
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:background="@drawable/progress_hud_bg"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    android:paddingBottom="20dp"
    android:paddingLeft="30dp"
    android:paddingRight="30dp"
    android:paddingTop="20dp" >

    <ImageView
        android:id="@+id/spinnerImageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@anim/spinner" />

    <TextView
        android:id="@+id/message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="15dp"
        android:text="Message"
        android:textColor="#FFFFFF" />

</LinearLayout>

         图片的背景是动画spinner,具体实现如下:
         
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false" >

    <item
        android:drawable="@drawable/spinner_0"
        android:duration="60"/>
    <item
        android:drawable="@drawable/spinner_1"
        android:duration="60"/>
    <item
        android:drawable="@drawable/spinner_2"
        android:duration="60"/>
    <item
        android:drawable="@drawable/spinner_3"
        android:duration="60"/>
    <item
        android:drawable="@drawable/spinner_4"
        android:duration="60"/>
    <item
        android:drawable="@drawable/spinner_5"
        android:duration="60"/>
    <item
        android:drawable="@drawable/spinner_6"
        android:duration="60"/>
    <item
        android:drawable="@drawable/spinner_7"
        android:duration="60"/>
    <item
        android:drawable="@drawable/spinner_8"
        android:duration="60"/>
    <item
        android:drawable="@drawable/spinner_9"
        android:duration="60"/>
    <item
        android:drawable="@drawable/spinner_10"
        android:duration="60"/>
    <item
        android:drawable="@drawable/spinner_11"
        android:duration="60"/>
</animation-list>
          这里提一下安卓的动画。android支持3种动画模式,tween animation,frame animation和property animation,这三种动画模式在SDK中被称为view animation,drawable animation和property animation
       tween animation(view animation):补间动画。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值