底部彈出PopupWindow,背景變為半透明效果,采用兩種方式實現
先來看看運行效果圖
[方式一]實現從底部彈出PopupWindow
原理:定義一個高度為wrap_content的PopupWindow布局文件,根據屏幕底部的位置顯示在Bottom
1.首先定義一個高度為wrap_content的PopupWindow布局文件
<?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:gravity="center" android:padding="8dp" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:orientation="vertical" android:background="@drawable/shape_info_bg"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="8dp" android:gravity="center" android:textColor="@color/theme_blue" android:text="拍照"/> <View android:layout_width="match_parent" android:layout_height="0.2dp" android:background="@color/theme_blue"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="8dp" android:gravity="center" android:textColor="@color/theme_blue" android:text="相冊"/> </LinearLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:padding="1dp"> <Button android:id="@+id/btn_cancle" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:padding="8dp" android:textColor="@color/theme_blue" android:background="@drawable/shape_info_bg" android:text="取消" /> </RelativeLayout> </LinearLayout>
另外有需要云服務器可以了解下創新互聯建站newbst.com,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業上云的綜合解決方案,具有“安全穩定、簡單易用、服務可用性高、性價比高”等特點與優勢,專為企業上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
網站標題:iOS實現底部彈出PopupWindow效果iOS改變背景透明效果-創新互聯
URL標題:http://newbst.com/article14/dggsde.html
成都網站建設公司_創新互聯,為您提供商城網站、網站收錄、云服務器、虛擬主機、ChatGPT、網站營銷
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯