日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > windows >内容正文

windows

android popupwindow 自定义背景,android – 无法将PopupWindow背景设置为透明

發(fā)布時(shí)間:2025/3/15 windows 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android popupwindow 自定义背景,android – 无法将PopupWindow背景设置为透明 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

我有以下代碼:

View child = getLayoutInflater().inflate(R.layout.contextual_menu_lp_activity,null)

child.setBackgroundColor(getResources().getColor(R.color.transparent));

child.setBackgroundDrawable(new BitmapDrawable());

popup = new PopupWindow(MapViewActivity.this);

popup.setContentView(child);

popup.showAtLocation(MapViewActivity.mapView,Gravity.CENTER,10,10);

popup.setBackgroundDrawable(new BitmapDrawable());

child.measure(View.MeasureSpec.UNSPECIFIED,View.MeasureSpec.UNSPECIFIED);

popup.update(50,50,child.getMeasuredWidth(),child.getMeasuredHeight());

正如您所看到的,我設(shè)置了視圖,并拼命嘗試使其背景透明.

在xml布局上,所有相對(duì)布局都被賦予透明的顏色背景.

這是xml:

xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical"

android:background="@color/transparent" >

android:id="@+id/ivDialogPopup"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_centerInParent="true"

android:paddingBottom="40dp"

android:background="@drawable/new_pop_up_bk" >

android:id="@+id/btLivePolice"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_toLeftOf="@+id/btSaveParkingLocation"

android:layout_marginRight="4dp"

android:layout_marginTop="8dp"

android:background="@drawable/live_police_button_popup" />

android:id="@+id/btSaveParkingLocation"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentTop="true"

android:layout_marginTop="8dp"

android:layout_centerHorizontal="true"

android:background="@drawable/parking_location_button" />

android:id="@+id/btGetDirections"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginLeft="4dp"

android:layout_marginTop="8dp"

android:layout_toRightOf="@+id/btSaveParkingLocation"

android:background="@drawable/directions_button" />

盡管如此,視圖的父布局(相對(duì)布局)仍然具有灰色背景.

(以前,我使用的是普通的活動(dòng)類(lèi),在清單中我有一個(gè)透明的主題 – 最重要的部分是將這個(gè)android:windowBackground設(shè)置為透明 – 我必須更改它的原因不同).

任何幫助表示贊賞.

總結(jié)

以上是生活随笔為你收集整理的android popupwindow 自定义背景,android – 无法将PopupWindow背景设置为透明的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。