本文簡單介紹自定義對話框Dialog的使用,代碼和結(jié)構(gòu)都非常簡單,目的是能夠快速使用自定義對話框,在本文中不具體講解對話框的高級使用。

實現(xiàn)步驟
首先需要自己在我們的.xml文件中自己構(gòu)建布局
布局文件做好之后,我們可以在style文件下自己定義布局的樣式
前兩步都做好之后,我開始在寫java文件
具體實現(xiàn)過程
1. xml文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="300dp"
android:layout_height="180dp"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@android:color/holo_green_light">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="IP設(shè)置"
android:textColor="#fff"
android:textSize="24sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#fff"
android:gravity="center"
android:orientation="horizontal"
android:padding="5dp">
<EditText
android:id="@+id/et_ip1"
android:layout_weight="1"
android:inputType="phone"
android:maxLength="3"
android:textColor="@color/colorPrimary" />
<EditText
android:id="@+id/et_ip2"
android:layout_weight="1"
android:inputType="phone"
android:maxLength="3"
android:textColor="@color/colorPrimary" />
<EditText
android:id="@+id/et_ip3"
android:layout_weight="1"
android:inputType="phone"
android:maxLength="3"
android:textColor="@color/colorPrimary" />
<EditText
android:id="@+id/et_ip4"
android:layout_weight="1"
android:inputType="phone"
android:maxLength="3"
android:textColor="@color/colorPrimary" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:orientation="horizontal">
<Button
android:id="@+id/btn_ipok"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/holo_green_light"
android:text="確認(rèn)"
android:textColor="#fff"
android:textSize="30sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#fff" />
<Button
android:id="@+id/btn_ipcancle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/holo_green_light"
android:text="取消"
android:textColor="#fff"
android:textSize="30sp" />
</LinearLayout>
</LinearLayout>
新聞名稱:Android自定義對話框Dialog-創(chuàng)新互聯(lián)
當(dāng)前URL:http://www.yijiale78.com/article2/docooc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計、Google、全網(wǎng)營銷推廣、關(guān)鍵詞優(yōu)化、域名注冊、企業(yè)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)