最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android仿微信進(jìn)度彈出框的實(shí)現(xiàn)方法

 更新時(shí)間:2017年01月04日 17:16:26   作者:rururu2211785113  
最近公司項(xiàng)目需要實(shí)現(xiàn)類似微信進(jìn)度條彈出框效果,其實(shí)現(xiàn)方法并不難,下面給大家介紹下Android仿微信進(jìn)度彈出框的實(shí)現(xiàn)方法,需要的朋友參考下吧

MainActivity:

package com.ruru.dialogproject; 
import android.app.Activity; 
import android.os.Bundle; 
import android.view.View; 
public class MainActivity extends Activity implements Runnable { 
 LoadingDialog dialog; 
 @Override 
 protected void onCreate(Bundle savedInstanceState) { 
  super.onCreate(savedInstanceState); 
  setContentView(R.layout.activity_main); 
  findViewById(R.id.btn_name).setOnClickListener(new View.OnClickListener() { 
   @Override 
   public void onClick(View view) { 
    dialog = new LoadingDialog(MainActivity.this); 
    dialog.setCanceledOnTouchOutside(false); 
    dialog.show(); 
    new Thread(MainActivity.this).start(); 
   } 
  }); 
 } 
 public void run() { 
  try { 
   Thread.sleep(5000); 
   dialog.dismiss(); 
  } catch (InterruptedException e) { 
   e.printStackTrace(); 
  } 
 } 
} 

activity_main:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
 xmlns:tools="http://schemas.android.com/tools" 
 android:id="@+id/activity_main" 
 android:layout_width="match_parent" 
 android:layout_height="match_parent" 
 tools:context="com.ruru.dialogproject.MainActivity"> 
 <Button 
  android:id="@+id/btn_name" 
  android:layout_width="match_parent" 
  android:layout_height="wrap_content" 
  android:text="Hello World!" /> 
</RelativeLayout>

LoadingDialog:

package com.ruru.dialogproject; 
import android.app.Dialog; 
import android.content.Context; 
import android.os.Bundle; 
import android.widget.LinearLayout; 
import android.widget.TextView; 
/** 
 * Created by 27c1 on 2017/1/4. 
 */ 
public class LoadingDialog extends Dialog { 
 private TextView tv; 
 /** 
  * style很關(guān)鍵 
  */ 
 public LoadingDialog(Context context) { 
  super(context, R.style.loadingDialogStyle); 
 } 
 @Override 
 protected void onCreate(Bundle savedInstanceState) { 
  super.onCreate(savedInstanceState); 
  setContentView(R.layout.dialog_loading); 
  tv = (TextView) findViewById(R.id.tv); 
  tv.setText("正在上傳....."); 
  LinearLayout linearLayout = (LinearLayout) this.findViewById(R.id.LinearLayout); 
  linearLayout.getBackground().setAlpha(210); 
 } 
} 

dialog_loading:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
 android:layout_width="fill_parent" 
 android:layout_height="fill_parent" 
 android:background="@android:color/transparent" 
 android:orientation="vertical"> 
 <LinearLayout 
  android:id="@+id/LinearLayout" 
  android:layout_width="160dp" 
  android:layout_height="160dp" 
  android:background="@drawable/yuanjiao" 
  android:gravity="center" 
  android:orientation="vertical"> 
  <ProgressBar 
   android:id="@+id/progressBar1" 
   style="?android:attr/progressBarStyleInverse" 
   android:layout_width="wrap_content" 
   android:layout_height="wrap_content" 
   android:layout_gravity="center" 
   android:background="@android:color/transparent" /> 
  <TextView 
   android:id="@+id/tv" 
   android:layout_width="wrap_content" 
   android:layout_height="wrap_content" 
   android:layout_gravity="center" 
   android:paddingTop="10dp" 
   android:textColor="#fff" /> 
 </LinearLayout> 
</LinearLayout> 

R.style.loadingDialogStyle:

<style name="loadingDialogStyle" parent="android:Theme.Dialog"> 
  <item name="android:windowBackground">@android:color/transparent</item><!--設(shè)置dialog的背景--> 
  <item name="android:windowFrame">@null</item><!--Dialog的windowFrame框?yàn)闊o--> 
  <item name="android:windowNoTitle">true</item><!--是否顯示title--> 
  <item name="android:windowIsFloating">true</item><!--是否浮現(xiàn)在activity之上--> 
  <item name="android:windowIsTranslucent">true</item><!--是否半透明--> 
  <item name="android:windowContentOverlay">@null</item><!--是否半透明--> 
  <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item><!-- 對話框是否有遮蓋 --> 
  <item name="android:backgroundDimEnabled">false</item><!--背景是否模糊顯示--> 
  <item name="android:backgroundDimAmount">0.6</item><!--背景的灰度--> 
 </style> 

drawable-yuanjiao:

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
 <solid android:color="#86222222" /> 
 <corners 
  android:bottomLeftRadius="10dp" 
  android:bottomRightRadius="10dp" 
  android:topLeftRadius="10dp" 
  android:topRightRadius="10dp" /> 
</shape>

效果:

關(guān)于樣式:

<item name="android:windowFrame">@null</item> :Dialog的windowFrame框?yàn)闊o 
<item name="android:windowIsFloating">true</item>:是否浮現(xiàn)在activity之上 
<item name="android:windowIsTranslucent">false</item>:是否半透明 
<item name="android:windowNoTitle">true</item>:是否顯示title 
<item name="android:windowBackground">@drawable/dia_bg</item>:設(shè)置dialog的背景 
<item name="android:backgroundDimEnabled">true</item>背景是否模糊顯示 
<item name="android:backgroundDimAmount">0.6</item>背景的灰度 

Window attributes屬性詳解

顏色為:#393939

以上所述是小編給大家介紹的Android仿微信進(jìn)度彈出框效果,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

  • Android實(shí)現(xiàn)3D翻轉(zhuǎn)動(dòng)畫效果

    Android實(shí)現(xiàn)3D翻轉(zhuǎn)動(dòng)畫效果

    這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)3D翻轉(zhuǎn)動(dòng)畫效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-12-12
  • Android布局控件之常用linearlayout布局

    Android布局控件之常用linearlayout布局

    LinearLayout是線性布局控件,它包含的子控件將以橫向或豎向的方式排列,按照相對位置來排列所有的widgets或者其他的containers,超過邊界時(shí),某些控件將缺失或消失
    2016-01-01
  • 詳解Android中Intent的使用方法

    詳解Android中Intent的使用方法

    這篇文章主要介紹了Android中Intent的使用方法,Android中的Intent是一個(gè)非常重要且常用的類,需要認(rèn)真學(xué)習(xí),感興趣的小伙伴們可以參考一下
    2015-12-12
  • Android Bluetooth藍(lán)牙技術(shù)使用流程詳解

    Android Bluetooth藍(lán)牙技術(shù)使用流程詳解

    這篇文章主要介紹了Android Bluetooth藍(lán)牙技術(shù)使用流程詳解的相關(guān)資料,需要的朋友可以參考下
    2016-02-02
  • Android中Window添加View的底層原理

    Android中Window添加View的底層原理

    這篇文章主要介紹了Android中Window添加View的底層原理,需要的朋友可以參考下
    2016-03-03
  • Flutter Element概念簡明分析

    Flutter Element概念簡明分析

    Flutter 中 Element 作用的是作為中樞來管理和調(diào)度Widget和RenderObject,這里我們主要說一下RenderObjectWidget 來主要說一下Element 的生命周期,這里我刪除了一些assert 的方法,方便查看
    2023-04-04
  • Android應(yīng)用程序窗口(Activity)窗口對象(Window)創(chuàng)建指南

    Android應(yīng)用程序窗口(Activity)窗口對象(Window)創(chuàng)建指南

    本文將詳細(xì)介紹Android應(yīng)用程序窗口(Activity)的窗口對象(Window)的創(chuàng)建過程,需要了解的朋友可以參考下
    2012-12-12
  • Android文本與視圖基本操作梳理介紹

    Android文本與視圖基本操作梳理介紹

    下面介紹一下android如何設(shè)置文本內(nèi)容、設(shè)置文本字體大小、文本顏色、視圖寬高、視圖間距、和視圖的對齊方式,只簡單說明一下如何操作,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧
    2022-09-09
  • Android 系統(tǒng)語言切換監(jiān)聽和設(shè)置實(shí)例代碼

    Android 系統(tǒng)語言切換監(jiān)聽和設(shè)置實(shí)例代碼

    本篇文章主要介紹了Android 系統(tǒng)語言切換監(jiān)聽和設(shè)置實(shí)例代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-06-06
  • Android實(shí)現(xiàn)炫酷的CheckBox效果

    Android實(shí)現(xiàn)炫酷的CheckBox效果

    大家是不是對系統(tǒng)自帶的CheckBox產(chǎn)生乏味感了呢?今天這篇文章給大家?guī)淼氖且豢钊碌腃heckBox,下面來一起看看下面的CheckBox吧!有需要的朋友們可以參考借鑒。
    2016-10-10

最新評論

保德县| 大荔县| 北川| 建德市| 揭西县| 蓬安县| 邛崃市| 名山县| 伊川县| 泉州市| 延吉市| 松江区| 巴里| 从化市| 夹江县| 宾阳县| 凌海市| 彰化市| 郯城县| 探索| 大方县| 辽源市| 陆良县| 天长市| 岳池县| 南京市| 双峰县| 沿河| 南丰县| 广河县| 五原县| 开化县| 凭祥市| 横山县| 共和县| 霍林郭勒市| 色达县| 台南市| 武川县| 阿拉善左旗| 三都|