android-popupwindow

Should I use a PopupWindow or DialogFragment for accepting input?

坚强是说给别人听的谎言 提交于 2019-11-27 03:09:19
问题 I am doing a Popup with 3 Spinners and an EditText. After reading many blogs and articles I can't decide which is the best option, PopupWindow or DialogFragment . The criteria would be: Compatibility with different Android's versions Performance If there is a better way to do it I am open to change the perspective. Thank you very much. DialogFragment: Pros: Cons: PopupWindow: Pros: Cons: EDIT: CONCLUSION DialogFragment allows you to use more complex features. Another important thing is that

How to create a popup window (PopupWindow) in Android

筅森魡賤 提交于 2019-11-26 17:22:56
To create a simple working PopupWindow, we need to do the following: popup_example.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="10dip" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10dip" android:text="Test Pop-Up" /> </LinearLayout> Java code LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

Android PopupWindow elevation does not show shadow

感情迁移 提交于 2019-11-26 16:22:17
问题 Android PopupWindow does not show shadows when the elevation is set. It appears to support it from the documentation. I am using 5.0 Lollipop. Creating the popup as follows: popupWindow = new PopupWindow(context); popupWindow.setOutsideTouchable(true); popupWindow.setFocusable(true); popupWindow.setElevation(10); popupWindow.setContentView(rootView); popupWindow.showAtLocation(anchorView, Gravity.NO_GRAVITY, xPos, yPos); 回答1: As answered by an Android developer. If the inflated view doesn't

Change background popupMenu in Android

淺唱寂寞╮ 提交于 2019-11-26 14:38:40
问题 I tried to change background of popupmenu, but my implementation does not work. This is my code: <style name="MyHoloLight" parent="android:Theme.Holo.Light"> <item name="android:popupMenuStyle">@style/popupMenuStyle</item> </style> <style name="popupMenuStyle" parent="@android:style/Widget.PopupMenu"> <item name="android:popupBackground">@color/bgPopumMenu</item> </style> Apply in AndroidManifest.xml <application android:hardwareAccelerated="true" android:label="@string/app_name" android:icon

Android popup window not filling screen size?

若如初见. 提交于 2019-11-26 14:35:54
问题 I am trying to make a simple pop up window. But every time I make one, it ends up being super small...and not the length I want it to be. This is how the pop up looks: Here is my layout for the pop up: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/popup_element" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#444444" android:padding="10px" android:orientation=

Blur or dim background when Android PopupWindow active

心已入冬 提交于 2019-11-26 14:07:59
I would like to be able to either blur or dim the background when I show my popup window using popup.showAtLocation , and unblur/dim the background when popup.dismiss is called. I have tried applying layout params FLAG_BLUR_BEHIND and FLAG_DIM_BEHIND to my activity, but this appears to just blur and dim the background as soon my app is started. How can I do blurring/dimming just with popups? The question was about the Popupwindow class, yet everybody has given answers that use the Dialog class. Thats pretty much useless if you need to use the Popupwindow class, because Popupwindow doesn't have

Is there a simple example of the PopupWindow class using Android v2.0?

天涯浪子 提交于 2019-11-26 05:22:24
问题 I looked online and was not able to find a working example of the PopupWindow class. The code examples I found online either compile but do not work, or are using methods which have since been removed (such as Activity.getViewInflate()) . Is there a simple working example that displays a PopupWindow? 回答1: I created a working example based on this Google Groups post. To create a simple working PopupWindow, you'll need to do the following: Create a layout XML which describes the View that will