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

Android使用Dialog風(fēng)格彈出框的Activity

 更新時(shí)間:2020年04月18日 16:03:27   作者:qq_20785431  
這篇文章主要為大家詳細(xì)介紹了Android使用Dialog風(fēng)格彈出框的Activity,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

在Android中經(jīng)常會(huì)遇到需要使用Dialog風(fēng)格彈出框的activity,首先我們可能會(huì)首先想到的是在XML布局文件中設(shè)置android:layout_height="wrap_content"屬性,讓activity的高度自適應(yīng),顯然這還不行,我們還需要為其DialogActivity設(shè)置自定義一個(gè)樣式 

<style name="dialogstyle">
 <!--設(shè)置dialog的背景-->
 <item name="android:windowBackground">@android:color/transparent</item>
 <!--設(shè)置Dialog的windowFrame框?yàn)闊o-->
 <item name="android:windowFrame">@null</item>
 <!--設(shè)置無標(biāo)題-->
 <item name="android:windowNoTitle">true</item>
 <!--是否浮現(xiàn)在activity之上-->
 <item name="android:windowIsFloating">true</item>
 <!--是否半透明-->
 <item name="android:windowIsTranslucent">true</item>
 <!--設(shè)置窗口內(nèi)容不覆蓋-->
 <item name="android:windowContentOverlay">@null</item>
 <!--設(shè)置動(dòng)畫,在這里使用讓它繼承系統(tǒng)的Animation.Dialog-->
 <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
 <!--背景是否模糊顯示-->
 <item name="android:backgroundDimEnabled">true</item>
 </style>

然后在AndroidManifest.xml中設(shè)置DialogActivity的樣式為我們自定義的dialogstyle

如下是布局的代碼 

<?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="wrap_content"
 android:background="@color/white"
 android:orientation="vertical">

 <LinearLayout
 android:layout_width="match_parent"
 android:layout_height="65dp"
 android:orientation="horizontal"
 android:paddingLeft="@dimen/acitvity_margin"
 android:paddingRight="@dimen/acitvity_margin">

 <LinearLayout
 android:layout_width="0dp"
 android:layout_height="match_parent"
 android:layout_weight="1"
 android:orientation="horizontal">

 <TextView
 android:layout_width="wrap_content"
 android:layout_height="match_parent"
 android:gravity="center"
 android:text="上班時(shí)間:"
 android:textColor="@color/grey"
 android:textSize="@dimen/size_text_medium" />

 <Button
 android:id="@+id/tv_signin_time"
 android:layout_width="wrap_content"
 android:layout_height="match_parent"
 android:background="@color/white"
 android:gravity="center"
 android:text="9:00"
 android:textColor="@color/grey"
 android:textSize="@dimen/size_text_medium" />
 </LinearLayout>

 <LinearLayout
 android:layout_width="0dp"
 android:layout_height="match_parent"
 android:layout_weight="1"
 android:orientation="horizontal">

 <TextView
 android:layout_width="wrap_content"
 android:layout_height="match_parent"
 android:gravity="center"
 android:text="下班時(shí)間:"
 android:textColor="@color/grey"
 android:textSize="@dimen/size_text_medium" />

 <Button
 android:id="@+id/tv_signout_time"
 android:layout_width="wrap_content"
 android:layout_height="match_parent"
 android:background="@color/white"
 android:gravity="center"
 android:text="18:00"
 android:textColor="@color/grey"
 android:textSize="@dimen/size_text_medium" />
 </LinearLayout>
 </LinearLayout>

 <RelativeLayout
 android:layout_width="match_parent"
 android:layout_height="65dp"
 android:paddingLeft="@dimen/acitvity_margin"
 android:paddingRight="@dimen/acitvity_margin">

 <TextView
 android:layout_width="wrap_content"
 android:layout_height="match_parent"
 android:layout_alignParentLeft="true"
 android:gravity="center"
 android:text="公司位置:"
 android:textColor="@color/grey"
 android:textSize="@dimen/size_text_medium" />

 <EditText
 android:id="@+id/et_address"
 android:layout_width="wrap_content"
 android:layout_height="match_parent"
 android:layout_marginLeft="2dp"
 android:layout_toRightOf="@+id/tv_address"
 android:background="@color/white"
 android:hint="請(qǐng)輸入公司位置"
 android:singleLine="true"
 android:textSize="@dimen/size_text_small" />

 <TextView
 android:id="@+id/tv_location"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_alignParentRight="true"
 android:layout_centerInParent="true"
 android:gravity="center"
 android:padding="5dp"
 android:text="重新定位"
 android:textColor="@color/blue"
 android:textSize="@dimen/size_text_medium" />
 </RelativeLayout>

 <RelativeLayout
 android:layout_width="match_parent"
 android:layout_height="65dp"
 android:paddingLeft="@dimen/acitvity_margin"
 android:paddingRight="@dimen/acitvity_margin">

 <TextView
 android:layout_width="wrap_content"
 android:layout_height="match_parent"
 android:layout_alignParentLeft="true"
 android:gravity="center"
 android:text="設(shè)置管理員:"
 android:textColor="@color/grey"
 android:textSize="@dimen/size_text_medium" />

 <ImageView
 android:layout_width="wrap_content"
 android:layout_height="match_parent"
 android:layout_alignParentRight="true"
 android:gravity="center"
 android:src="@mipmap/icon_toright" />
 </RelativeLayout>
</LinearLayout> 

接下來我們?cè)倏匆幌滦Ч麍D是不是我們想要的呢

源碼下載:http://xiazai.jb51.net/201609/yuanma/DialogActivity(jb51.net).rar

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

相關(guān)文章

  • Android使用CountDownTimer類實(shí)現(xiàn)倒計(jì)時(shí)鬧鐘

    Android使用CountDownTimer類實(shí)現(xiàn)倒計(jì)時(shí)鬧鐘

    這篇文章主要為大家詳細(xì)介紹了Android使用CountDownTimer類實(shí)現(xiàn)倒計(jì)時(shí)鬧鐘,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-01-01
  • AndroidStudio4.0日志中文亂碼問題

    AndroidStudio4.0日志中文亂碼問題

    這篇文章主要介紹了AndroidStudio4.0日志中文亂碼問題,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-10-10
  • Flutter 插件url_launcher簡(jiǎn)介

    Flutter 插件url_launcher簡(jiǎn)介

    最近項(xiàng)目需求是打開一個(gè)連接跳轉(zhuǎn)到安卓或蘋果默認(rèn)的瀏覽器。雖然開始一個(gè)簡(jiǎn)單的要求,其中的一個(gè)細(xì)節(jié)就是執(zhí)行打開網(wǎng)頁這一操作后,不能看上去像在應(yīng)用內(nèi)部打開,看上去要在應(yīng)用外部打開,今天小編給大家介紹Flutter 插件url_launcher的相關(guān)知識(shí),感興趣的朋友一起看看吧
    2020-04-04
  • web app與原生app的區(qū)別

    web app與原生app的區(qū)別

    本文主要給大家分析介紹了web app與原生app的區(qū)別,以及各自的優(yōu)勢(shì)和劣勢(shì),推薦給大家,有需要的小伙伴來參考下吧
    2015-03-03
  • 分析Android Activity的啟動(dòng)過程

    分析Android Activity的啟動(dòng)過程

    這篇文章主要介紹了分析Android Activity的啟動(dòng)過程的相關(guān)資料,需要的朋友可以參考下
    2017-07-07
  • android TextView實(shí)現(xiàn)跑馬燈效果

    android TextView實(shí)現(xiàn)跑馬燈效果

    這篇文章主要為大家詳細(xì)介紹了android TextView實(shí)現(xiàn)跑馬燈效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-06-06
  • android byte[] 和short[]轉(zhuǎn)換的方法代碼

    android byte[] 和short[]轉(zhuǎn)換的方法代碼

    這篇文章主要介紹了android byte[] 和short[]轉(zhuǎn)換的方法代碼,有需要的朋友可以參考一下
    2014-01-01
  • Android自定義View實(shí)現(xiàn)箭頭沿圓轉(zhuǎn)動(dòng)實(shí)例代碼

    Android自定義View實(shí)現(xiàn)箭頭沿圓轉(zhuǎn)動(dòng)實(shí)例代碼

    這篇文章主要介紹了Android自定義View實(shí)現(xiàn)箭頭沿圓轉(zhuǎn)動(dòng)實(shí)例代碼,需要的朋友可以參考下
    2017-09-09
  • UIImage初始化的區(qū)別兩種方法介紹(面試常見)

    UIImage初始化的區(qū)別兩種方法介紹(面試常見)

    本文通過兩種方法給大家介紹UIImage初始化的區(qū)別,在面試過程中經(jīng)常遇到,對(duì)uiimage初始化相關(guān)知識(shí)感興趣的朋友一起了解下吧
    2016-05-05
  • Flutter實(shí)現(xiàn)底部導(dǎo)航欄效果

    Flutter實(shí)現(xiàn)底部導(dǎo)航欄效果

    這篇文章主要為大家詳細(xì)介紹了Flutter實(shí)現(xiàn)底部導(dǎo)航欄效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-08-08

最新評(píng)論