zoukankan      html  css  js  c++  java
  • 软工超越日报-Android显示通知框 5/1

    网络通信时经常需要加载动画,那么今天我们来做一个显示加载弹框的dialog吧

    java调用代码如下:

    Dialog dialogs = new Dialog(this, R.style.DialogTheme);
            LayoutInflater inflaters = LayoutInflater.from(this);
            View viewDialogs = inflaters.inflate(R.layout.loading, null);
            int width = 1000;
            int height = 300;
            ViewGroup.LayoutParams layoutParamss = new  ViewGroup.LayoutParams(width, height);
            dialogs.setContentView(viewDialogs, layoutParamss);
            dialogs.setCanceledOnTouchOutside(false);
            dialogs.setCancelable(false);
            dialogs.findViewById(R.id.icos).setAnimation(rotate);
            dialogs.findViewById(R.id.icos).startAnimation(rotate);
            dialogs.show();

    layout文件如下:

    <?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="105sp"
        android:orientation="horizontal"
        android:padding="15sp">
    
        <ImageView
            android:id="@+id/icos"
            android:layout_width="85sp"
            android:layout_height="match_parent"
            android:src="@drawable/icon"
            />
    
        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="正在同步数据......"
            android:textSize="20sp"
            android:gravity="center"
            />
    
    </LinearLayout>

    具体实现效果如下:

  • 相关阅读:
    IntelliJ IDEA(十) :常用操作
    IntelliJ IDEA(九) :酷炫插件系列
    IntelliJ IDEA(八) :git的使用
    IntelliJ IDEA(七) :Project Structure
    IntelliJ IDEA(六) :Settings(下)
    IntelliJ IDEA(五) :Settings(中)
    Echo中间件使用
    Makefile
    swag-ui与swag-edit
    mysql 连接数太多
  • 原文地址:https://www.cnblogs.com/Sakuraba/p/14910387.html
Copyright © 2011-2022 走看看