欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android自定義仿ios加載彈窗

 更新時(shí)間:2021年05月18日 11:49:51   作者:一杯酒幾分愁  
這篇文章主要為大家詳細(xì)介紹了Android自定義仿ios加載彈窗,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了Android自定義仿ios加載彈窗的具體代碼,供大家參考,具體內(nèi)容如下

效果如下:

IosLoadDialog類(可直接復(fù)制):

public class IosLoadDialog extends Dialog {

    public IosLoadDialog(Context context) {
        super(context, R.style.loading_dialog);
        initView();
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        switch (keyCode){
            case KeyEvent.KEYCODE_BACK:
                if(IosLoadDialog.this.isShowing())
                    IosLoadDialog.this.dismiss();
                break;
        }
        return true;
    }


    private void initView(){
        setContentView(R.layout.dialog_loading);
        Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.load_animation);
        animation.setInterpolator(new LinearInterpolator());
        findViewById(R.id.loading_dialog_img).startAnimation(animation);

        setCanceledOnTouchOutside(true);
        WindowManager.LayoutParams attributes = getWindow().getAttributes();
        attributes.alpha=0.8f;
        getWindow().setAttributes(attributes);
        setCancelable(false);
    }
}

R.layout.dialog_loading文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/dialog_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/tm"
    android:gravity="center"
    android:minHeight="60dp"
    android:minWidth="180dp"
    android:orientation="vertical"
    android:padding="10dp">

    <LinearLayout
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:background="@drawable/white_radian13"
        android:gravity="center"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/loading_dialog_img"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:scaleType="fitXY"
            android:src="@drawable/ic_svstatus_loading" />
    </LinearLayout>

</LinearLayout>

loading_dialog樣式:

<style name="loading_dialog" parent="android:style/Theme.Dialog">
        <item name="android:windowFrame">@null</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowBackground">@color/tm</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:windowContentOverlay">@null</item>
    </style>

white_radian13白色透明圓角背景:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <solid android:color="#F7FBFD" />
            <corners android:radius="13dp" />
        </shape>
    </item>
</layer-list>

然后奉上圖片ic_svstatus_loading.png:

最后使用:

public void showDialog(){
        final IosLoadDialog iosLoadDialog = new IosLoadDialog(this);
        iosLoadDialog.show();
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                iosLoadDialog.dismiss();
            }
        },1200);
    }

好了,去試試吧!

以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Android自制精彩彈幕效果

    Android自制精彩彈幕效果

    這篇文章主要為大家詳細(xì)介紹了Android自制精彩彈幕效果,彈幕垂直方向可固定隨機(jī),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-08-08
  • Flutter 快速實(shí)現(xiàn)聊天會(huì)話列表效果示例詳解

    Flutter 快速實(shí)現(xiàn)聊天會(huì)話列表效果示例詳解

    這篇文章主要為大家介紹了Flutter 快速實(shí)現(xiàn)聊天會(huì)話列表效果示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-10-10
  • Android仿微信底部實(shí)現(xiàn)Tab選項(xiàng)卡切換效果

    Android仿微信底部實(shí)現(xiàn)Tab選項(xiàng)卡切換效果

    這篇文章主要為大家介紹了Android仿微信底部實(shí)現(xiàn)Tab選項(xiàng)卡切換效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-02-02
  • Android使用Fragment打造萬能頁面切換框架

    Android使用Fragment打造萬能頁面切換框架

    這篇文章主要介紹了Android使用Fragment打造萬能頁面切換框架的相關(guān)資料,需要的朋友可以參考下
    2016-01-01
  • 淺析Android的啟動(dòng)原理

    淺析Android的啟動(dòng)原理

    當(dāng)談到Android啟動(dòng)原理時(shí),我們進(jìn)入了Android操作系統(tǒng)的核心,理解Android系統(tǒng)啟動(dòng)的原理對(duì)于開發(fā)者來說非常重要,因?yàn)檫@有助于優(yōu)化應(yīng)用程序性能并提供更好的用戶體驗(yàn),本文給大家講講Android啟動(dòng)原理,需要的朋友可以參考下
    2023-10-10
  • Android AutoCompleteTextView控件基本用法示例

    Android AutoCompleteTextView控件基本用法示例

    這篇文章主要介紹了Android AutoCompleteTextView控件基本用法,結(jié)合實(shí)例形式分析了AutoCompleteTextView控件的功能、使用方法及相關(guān)操作步驟,需要的朋友可以參考下
    2016-06-06
  • Android使用listview實(shí)現(xiàn)分頁刷新(線程休眠模擬)

    Android使用listview實(shí)現(xiàn)分頁刷新(線程休眠模擬)

    這篇文章主要為大家詳細(xì)介紹了Android使用listview實(shí)現(xiàn)分頁刷新,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-11-11
  • Android星級(jí)評(píng)分條實(shí)現(xiàn)評(píng)分界面

    Android星級(jí)評(píng)分條實(shí)現(xiàn)評(píng)分界面

    這篇文章主要為大家詳細(xì)介紹了Android星級(jí)評(píng)分條實(shí)現(xiàn)評(píng)分界面,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-05-05
  • AsyncTask官方文檔教程整理

    AsyncTask官方文檔教程整理

    這篇文章主要跟大家分享了關(guān)于AsyncTask官方文檔的相關(guān)資料,文中介紹的非常詳細(xì),對(duì)大家具有一定的參考價(jià)值,需要的朋友們下面來一起看看吧。
    2017-04-04
  • Android編程之MD5加密算法實(shí)例分析

    Android編程之MD5加密算法實(shí)例分析

    這篇文章主要介紹了Android編程之MD5加密算法,結(jié)合實(shí)例形式較為詳細(xì)的分析了Android使用MD5加密的具體實(shí)現(xiàn)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-11-11

最新評(píng)論