android-popupwindow

Android Nougat 7.1.1 showAtLocation(…) Gravity not working

我们两清 提交于 2019-12-01 05:47:17
问题 This is related to this question: Android Nougat PopupWindow showAsDropDown(...) Gravity not working However, when I applied this fix: if (android.os.Build.VERSION.SDK_INT >=24) { int[] a = new int[2]; anchorView.getLocationInWindow(a); popUp.showAtLocation(((Activity) mContext).getWindow().getDecorView(), Gravity.NO_GRAVITY, 0 , a[1]+anchorView.getHeight()); } else{ popUp.showAsDropDown(anchorView); } It doesn't work on Android Nougat 7.1.1. Particularly on Google Pixel and Nexus 6p devices.

TextInputLayout: RuntimeException - Failed to resolve attribute at index 24

若如初见. 提交于 2019-11-30 17:05:29
I keep on getting this error when I try to setErrorEnabled on my textInputLayout : 03-12 12:29:03.206 5706-5706/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.myapp, PID: 5706 java.lang.RuntimeException: Failed to resolve attribute at index 24 at android.content.res.TypedArray.getColor(TypedArray.java:401) at android.widget.TextView.<init>(TextView.java:696) at android.widget.TextView.<init>(TextView.java:632) at android.widget.TextView.<init>(TextView.java:628) at android.widget.TextView.<init>(TextView.java:624) at android.support.design.widget.TextInputLayout.setErrorEnabled

How to show a customized Popup window near the touch location, like what we have when we use ContextMenu?

此生再无相见时 提交于 2019-11-30 09:40:17
问题 Background Seeing that it's not officially possible to have a context menu which has a customized view or even icons for its rows (here), I decided to create my own solution (of custom view that acts like it). The problem When using a context menu on a RecyclerView, the touch position matters, so if you long touch an item, the context menu will try to appear near the touch location (sample taken from here), and without me giving this information (meaning via OnClickListener or

TextInputLayout: RuntimeException - Failed to resolve attribute at index 24

你说的曾经没有我的故事 提交于 2019-11-30 00:23:59
问题 I keep on getting this error when I try to setErrorEnabled on my textInputLayout : 03-12 12:29:03.206 5706-5706/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.myapp, PID: 5706 java.lang.RuntimeException: Failed to resolve attribute at index 24 at android.content.res.TypedArray.getColor(TypedArray.java:401) at android.widget.TextView.<init>(TextView.java:696) at android.widget.TextView.<init>(TextView.java:632) at android.widget.TextView.<init>(TextView.java:628) at android.widget

dismiss the popup window by back button

烈酒焚心 提交于 2019-11-29 06:06:10
I want to Dismiss the popup window by clicking outside of the popup window or by the back button, but when click on the back button my application exit's, instead of exiting the application I want to close the popup window. here is my code, ivmainmenu.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub LayoutInflater layoutInflater = (LayoutInflater)getBaseContext() .getSystemService(LAYOUT_INFLATER_SERVICE); View popupView = layoutInflater.inflate(R.layout.popupwindow, null); final PopupWindow popupWindow = new PopupWindow

Android M ClassCastException: FrameLayout$LayoutParams cannot be cast to WindowManager$LayoutParams

做~自己de王妃 提交于 2019-11-29 00:42:16
This piece of code works seems to work in android api 16 - 22 but does not work in api 23. I'm simply trying to display a popupwindow with options in it and dim the background below the popupwindow: WindowPopUp windowPopUp = new WindowPopUp(mContext, mPlaces.get(position), position, fromSearch); windowPopUp.showAtLocation(v, Gravity.CENTER, 0, 0); View parent = (View) windowPopUp.getContentView().getParent(); //dim the window in the background WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); WindowManager.LayoutParams p = (WindowManager.LayoutParams) parent

Should I use a PopupWindow or DialogFragment for accepting input?

倾然丶 夕夏残阳落幕 提交于 2019-11-28 09:45:16
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 it is more tablet-friendly as it lets user to have opened more than one fragment at a time. Fragments

Android M ClassCastException: FrameLayout$LayoutParams cannot be cast to WindowManager$LayoutParams

假如想象 提交于 2019-11-27 15:24:12
问题 This piece of code works seems to work in android api 16 - 22 but does not work in api 23. I'm simply trying to display a popupwindow with options in it and dim the background below the popupwindow: WindowPopUp windowPopUp = new WindowPopUp(mContext, mPlaces.get(position), position, fromSearch); windowPopUp.showAtLocation(v, Gravity.CENTER, 0, 0); View parent = (View) windowPopUp.getContentView().getParent(); //dim the window in the background WindowManager wm = (WindowManager) mContext

Android PopupWindow elevation does not show shadow

a 夏天 提交于 2019-11-27 13:31:39
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); As answered by an Android developer . If the inflated view doesn't have a background set, or the popup window itself doesn't have a background set (or has a transparent

Android popup window not filling screen size?

▼魔方 西西 提交于 2019-11-27 09:14:08
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="vertical"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout