欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

如何使用Android仿微信網(wǎng)絡(luò)加載彈出框-創(chuàng)新互聯(lián)

這篇文章給大家分享的是有關(guān)如何使用Android仿微信網(wǎng)絡(luò)加載彈出框的內(nèi)容。小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過(guò)來(lái)看看吧。

創(chuàng)新互聯(lián)主要從事成都做網(wǎng)站、成都網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)無(wú)錫,10多年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專(zhuān)業(yè),歡迎來(lái)電咨詢(xún)建站服務(wù):18980820575

1. 自定義view的style樣式

<resources>  <!-- Base application theme. -->  <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">    <!-- Customize your theme here. -->    <item name="colorPrimary">@color/colorPrimary</item>    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>    <item name="colorAccent">@color/colorAccent</item>  </style>  <!-- 自定義dialog的樣式 -->  <style name="CustomDialog">    <item name="android:windowFrame">@null</item><!--邊框-->    <item name="android:windowIsFloating">true</item><!--是否浮現(xiàn)在activity之上-->    <item name="android:windowIsTranslucent">false</item><!--半透明-->    <item name="android:windowNoTitle">true</item><!--無(wú)標(biāo)題-->    <item name="android:windowBackground">@drawable/dialog_custom_bg</item><!--背景透明-->    <item name="android:backgroundDimEnabled">false</item><!--模糊-->    <item name="android:backgroundDimAmount">0.6</item>  </style></resources>

2.dialog_custom_bg 加載動(dòng)畫(huà)shape背景圖(drawable文件夾下)

<shape xmlns:android="http://schemas.android.com/apk/res/android"  android:shape="rectangle">  <solid android:color="#ff333333" />  <corners android:radius="5dp" /></shape>

3.indeterminate_drawable 進(jìn)度條模糊背景圖(drawable文件夾下)

<?xml version="1.0" encoding="utf-8"?><rotate xmlns:android="http://schemas.android.com/apk/res/android"  android:drawable="@drawable/loading"  android:fromDegrees="0"  android:pivotX="50%"  android:pivotY="50%"  android:toDegrees="360"></rotate>

4.加載對(duì)話(huà)框的背景

<!-- 加載對(duì)話(huà)框布局 --><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  android:layout_width="wrap_content"  android:layout_height="wrap_content"  android:gravity="center"  android:orientation="horizontal"  android:padding="10dp">  <ProgressBar    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:indeterminateDrawable="@drawable/indeterminate_drawable"    android:indeterminateDuration="1800" />  <TextView    android:id="@+id/tvcontent"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:paddingLeft="10dp"    android:paddingRight="10dp"    android:text="加載中"    android:textColor="#ffffff"    android:textSize="14sp" /></LinearLayout>

5.CustomDialog自定義控件

public class CustomDialog extends Dialog {  private String content;  public CustomDialog(Context context, String content) {    super(context, R.style.CustomDialog);    this.content=content;    initView();  }  @Override  public boolean onKeyDown(int keyCode, KeyEvent event) {    switch (keyCode){      case KeyEvent.KEYCODE_BACK:        if(CustomDialog.this.isShowing())          CustomDialog.this.dismiss();        break;    }    return true;  }  private void initView(){    setContentView(R.layout.dialog_view);    ((TextView)findViewById(R.id.tvcontent)).setText(content);    setCanceledOnTouchOutside(true);    WindowManager.LayoutParams attributes = getWindow().getAttributes();    attributes.alpha=0.8f;    getWindow().setAttributes(attributes);    setCancelable(false);  }}

6.Activity中直接調(diào)用

CustomDialog customDialog = new CustomDialog(this, "正在加載...");customDialog.show();//顯示,顯示時(shí)頁(yè)面不可點(diǎn)擊,只能點(diǎn)擊返回customDialog.dismiss();//消失

感謝各位的閱讀!關(guān)于“如何使用Android仿微信網(wǎng)絡(luò)加載彈出框”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!

網(wǎng)站名稱(chēng):如何使用Android仿微信網(wǎng)絡(luò)加載彈出框-創(chuàng)新互聯(lián)
轉(zhuǎn)載源于:http://www.chinadenli.net/article14/pcdge.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App設(shè)計(jì)品牌網(wǎng)站制作面包屑導(dǎo)航手機(jī)網(wǎng)站建設(shè)網(wǎng)站收錄網(wǎng)站改版

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)