免费观看又色又爽又黄的小说免费_美女福利视频国产片_亚洲欧美精品_美国一级大黄大色毛片

HTML怎么自定義dialog背景-創新互聯

HTML怎么自定義dialog背景?這個問題可能是我們日常學習或工作經常見到的。希望通過這個問題能讓你收獲頗深。下面是小編給大家帶來的參考內容,讓我們一起來看看吧!

創新互聯建站主要為客戶提供服務項目涵蓋了網頁視覺設計、VI標志設計、營銷網站、網站程序開發、HTML5響應式網站建設公司手機網站制作設計、微商城、網站托管及成都企業網站維護、WEB系統開發、域名注冊、國內外服務器租用、視頻、平面設計、SEO優化排名。設計、前端、后端三個建站步驟的完善服務體系。一人跟蹤測試的建站服務標準。已經為橡塑保溫行業客戶提供了網站設計服務。

現在我們先來實現文章的第一個問題,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背景的簡單過程了,要想了解的更多,請上創新互聯建站了解更多知識。

現在我們說說如何自定義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>

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

感謝各位的閱讀!看完上述內容,你們對HTML怎么自定義dialog背景大概了解了嗎?希望文章內容對大家有所幫助。如果想了解更多相關文章內容,歡迎關注創新互聯網站制作公司行業資訊頻道。

網頁題目:HTML怎么自定義dialog背景-創新互聯
地址分享:http://newbst.com/article28/dggscp.html

成都網站建設公司_創新互聯,為您提供App開發搜索引擎優化品牌網站制作微信小程序全網營銷推廣網站內鏈

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

網站托管運營