六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

HTML如何自定義dialog背景?一篇文章教你如何自定義dialog!

[摘要]本篇文章主要為大家講述的是關于HTML中如何自定義dialog標簽的背景,還有其它的一些樣式設置,代碼很多,需要自己的理解,接下來就讓我們一起來看關于HTML dialog自定義的文章吧現在我們先來實現文章的第一個問題,HTML如何自定義dialog標簽的背景的:現在很多App的提示對話框都非常有...
本篇文章主要為大家講述的是關于HTML中如何自定義dialog標簽的背景,還有其它的一些樣式設置,代碼很多,需要自己的理解,接下來就讓我們一起來看關于HTML dialog自定義的文章吧

現在我們先來實現文章的第一個問題,HTML如何自定義dialog標簽的背景的:

現在很多App的提示對話框都非常有個性,然而你還用系統的對話框樣式,是不是覺得很落后呢,今天我就給大家講講怎樣自定義自己的Dialog,學會了之后,你就會根據自家app的主題,設計出相應的Dialog的風格。

好了接下來我就以一個簡單風格的自定義Dialog來講講自定義dialog的一般步驟和原理。

第一步: 給Dialog設置一個風格主題(基本都是用這個主題)無邊框全透明背景:

<!--自定義dialog背景全透明無邊框theme -->  
<style name="MyDialog" parent="android:style/Theme.Dialog">  
<!--背景顏色及和透明程度-->  
<item name="android:windowBackground">@android:color/transparent</item>  
</style>

dialog的自定義背景框如下:

<?xml version="1.0" encoding="utf-8"?>  
<shape xmlns:android="http://schemas.android.com/apk/res/android">  
    <solid android:color="#ffffff" />  
    <stroke  
        android:width="0.8dp"  
        android:color="#ffffff" />  
    <!-- 圓角 -->  
    <corners android:radius="6dp" />  
</shape>

以上就是在APP中自定義dialog背景的簡單過程了,要想了解的更多,請上PHP中文網了解更多知識。

現在我們說說如何自定義dialog:

東西很多,慢慢看

<style name="MyDialog" parent="android:style/Theme.Dialog">  
        <!--背景顏色及和透明程度-->  
        <item name="android:windowBackground">@android:color/transparent</item>  
        <!--是否去除標題 -->  
        <item name="android:windowNoTitle">true</item>  
        <!--是否去除邊框-->  
        <item name="android:windowFrame">@null</item>  
        <!--是否浮現在activity之上-->  
        <item name="android:windowIsFloating">true</item>  
        <!--是否模糊-->  
        <item name="android:backgroundDimEnabled">false</item>  
</style>

第二步:給自定的Dialog設置自定義的 xml界面,我這里只是示范,你可以使用單選,多選,3個按鈕,4個按鈕等等,格式各樣的自定義XML,我這里就定義了 標題title,信息message,還有一個確定按鈕和取消按鈕,如下:

<?xml version="1.0" encoding="utf-8"?>  
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
    android:layout_width="match_parent"  
    android:layout_height="match_parent"  
    android:background="#11ffffff">  
      <LinearLayout  
        android:layout_width="260dp"  
        android:layout_height="wrap_content"  
        android:layout_centerInParent="true"  
        android:background="@drawable/free_dialog_bg"  
        android:orientation="vertical">  
          <TextView  
            android:id="@+id/title"  
            android:layout_width="wrap_content"  
            android:layout_height="wrap_content"  
            android:layout_gravity="center"  
            android:layout_margin="15dp"  
            android:gravity="center"  
            android:text="消息提示"  
            android:textColor="#38ADFF"  
            android:textSize="16sp" />  
          <TextView  
            android:id="@+id/message"  
            android:layout_width="wrap_content"  
            android:layout_height="wrap_content"  
            android:layout_marginLeft="20dp"  
            android:layout_marginRight="20dp"  
            android:text="提示消息" />  
        <View  
            android:layout_width="match_parent"  
            android:layout_height="1px"  
            android:layout_marginTop="15dp"  
            android:background="#E4E4E4" />  
<LinearLayout  
            android:layout_width="match_parent"  
            android:layout_height="40dp"  
            android:orientation="horizontal">  
              <Button  
                android:id="@+id/no"  
                android:layout_width="0dp"  
                android:layout_height="match_parent"  
                android:layout_marginLeft="10dp"  
                android:layout_weight="1"  
                android:background="@null"  
                android:gravity="center"  
                android:singleLine="true"  
                android:text="No"  
                android:textColor="#7D7D7D"  
                android:textSize="16sp" />  
              <View  
                android:layout_width="1px"  
                android:layout_height="match_parent"  
                android:background="#E4E4E4" />  
              <Button  
                android:id="@+id/yes"  
                android:layout_width="0dp"  
                android:layout_height="match_parent"  
                android:layout_marginRight="10dp"  
                android:layout_weight="1"  
                android:background="@null"  
                android:gravity="center"  
                android:singleLine="true"  
                android:text="Yes"  
                android:textColor="#38ADFF"  
                android:textSize="16sp" />  
        </LinearLayout>  
    </LinearLayout>  
  </RelativeLayout>

dialog的自定義背景框如下:

<?xml version="1.0" encoding="utf-8"?>  
<shape xmlns:android="http://schemas.android.com/apk/res/android">  
    <solid android:color="#ffffff" />  
    <stroke  
        android:width="0.8dp"  
        android:color="#ffffff" />  
    <!-- 圓角 -->  
    <corners android:radius="6dp" />  
</shape>

這就完成了雖然很長,但是學習是個很慢的過程。一點一點的來吧

好了,本篇文章到這也就結束了,歡迎大家的觀看,有什么疑問可以在下方提問。

【小編推薦】

html5 footer標簽怎么用?footer標簽的用法實例

html frame標簽怎么使用?frame標簽的用法介紹(附實例)

以上就是HTML如何自定義dialog背景?一篇文章教你如何自定義dialog!的詳細內容,更多請關注php中文網其它相關文章!


網站建設是一個廣義的術語,涵蓋了許多不同的技能和學科中所使用的生產和維護的網站。




主站蜘蛛池模板: 特级毛片黑人三人共一女 | 天天综合网在线 | 青青青国产精品国产精品美女 | 片成年免费观看网站黄 | 亚洲 丝袜 制服 欧美 另类 | 天堂中文资源在线地址 | 亚洲另类图区 | 亚洲精品中文字幕无乱码 | 婷婷色九月 | 色噜噜狠狠狠狠色综合久不 | 欧美一区日韩一区中文字幕页 | 天堂网在线资源 | 伊人一区二区三区 | 亚洲福利二区 | 日本大片在线免费观看 | 在线观看欧美三级 | 亚洲欧洲在线视频 | 四虎影院在线视频 | 色天天干 | 日韩在线影院 | 亚洲一区二区三区在线免费观看 | 中文国产 | 日韩啪啪网站 | 色综合天天综合网国产国产人 | 四虎永久在线精品网址 | 最新版天堂中文在线官网 | 四虎国产精品免费观看 | 亚洲视频自拍 | 中文成人在线视频 | 色天天色综合 | 亚洲日韩精品欧美一区二区 | 欧美太黄太色视频在线观看 | 窝窝午夜视频 | 特黄a大片免费视频 | 偷自视频区视频真实在线 | 性刺激欧美三级在线观看 | 青青草原国产在线观看 | 亚洲免费网站在线观看 | 日本爽爽爽爽爽爽在线观看免 | 人禽交在线视频免费播放 | 日日爽爽 |