項(xiàng)目要用到彈出框,還要和蘋果的樣式一樣(Android真是沒地位),所以就自己定義了一個(gè),不是很像(主要是沒圖),但是也還可以。
廢話不多說(shuō)了,直接上代碼
1、先看布局文件
<?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="match_parent" android:padding="20dp" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:background="@drawable/custom_dialog_background" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="vertical"> <TextView android:id="@+id/tv_title_custom_dialog" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:text="提醒" android:textColor="#000" android:textSize="18dp" /> <TextView android:id="@+id/tv_message_custom_dialog" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:text="您確定要取消訂單嗎" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="0.5dp" android:layout_marginTop="20dp" android:background="#dfdfdf" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/btn_negative_custom_dialog" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@android:color/transparent" android:text="取消" android:textColor="@android:color/holo_blue_dark" /> <View android:layout_width="0.5dp" android:layout_height="match_parent" android:background="#dfdfdf" /> <Button android:id="@+id/btn_positive_custom_dialog" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@android:color/transparent" android:text="確定" android:textColor="@android:color/holo_blue_dark" /> </LinearLayout> </LinearLayout> </LinearLayout>
當(dāng)前題目:Android自定義彈出框dialog效果-創(chuàng)新互聯(lián)
網(wǎng)站URL:http://jinyejixie.com/article10/dpcpgo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT、App設(shè)計(jì)、企業(yè)建站、網(wǎng)站策劃、手機(jī)網(wǎng)站建設(shè)、標(biāo)簽優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容