弹出窗口 window 未在 android L 中正确显示
popup window is not properly shown in android L
这是 android L :
上的样子
在果冻豆上它看起来像:
这里是布局xml文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:customfont="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:background="@color/black_bg_dialog"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_marginRight="30dp"
android:layout_marginLeft="30dp"
android:layout_centerInParent="true"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical"
android:background="@color/enquiry_bg">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/enquiry_text_top"
customfont:customTypeface="fonts/Roboto-Light.ttf"
android:text="@string/contact_us" />
<EditText
android:id="@+id/et_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/name"
android:ellipsize="end"
android:hint="@string/contact_hint_name"
android:inputType="text"
android:singleLine="true"
android:textColor="@color/enquiry_text"
android:layout_marginTop="20dp"
android:textColorHint="@color/enquiry_text_hint"
android:textSize="18sp" />
<EditText
android:id="@+id/et_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/email"
android:ellipsize="end"
android:hint="@string/contact_hint_email"
android:inputType="textEmailAddress"
android:singleLine="true"
android:textColor="@color/enquiry_text"
android:layout_marginTop="20dp"
android:textColorHint="@color/enquiry_text_hint"
android:textSize="18sp" />
<EditText
android:id="@+id/et_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/phonenumber"
android:ellipsize="end"
android:hint="@string/contact_hint_phone"
android:inputType="phone"
android:singleLine="true"
android:textColor="@color/enquiry_text"
android:layout_marginTop="20dp"
android:textColorHint="@color/enquiry_text_hint"
android:textSize="18sp" />
<FrameLayout
android:id="@+id/fl_send"
android:layout_width="match_parent"
android:background="@color/enquiry_send_bg"
android:layout_marginTop="20dp"
android:layout_gravity="center"
android:padding="10dp"
android:layout_height="wrap_content">
<TextView
android:id="@+id/btn_submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="20dp"
android:drawableRight="@drawable/sendbutton"
android:text="@string/contact_btn_submit"
android:textColor="@color/white"
android:layout_gravity="center"
android:gravity="center"
customfont:customTypeface="fonts/Roboto-Regular.ttf"
android:textSize="23sp" />
</FrameLayout>
</LinearLayout>
<RelativeLayout
android:id="@+id/rl_progress_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/loading_alpha"
android:visibility="gone">
<ImageView
android:id="@+id/iv_progress_icon"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
</RelativeLayout>
和弹出代码 window :
View popUpView = activity.getLayoutInflater().inflate(R.layout.dialog_contact_us, null);
enquiryPopUp = new PopupWindow(popUpView, RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT, true);
enquiryPopUp.setBackgroundDrawable(new BitmapDrawable(null, ""));
enquiryPopUp.setAnimationStyle(android.R.style.Animation_Dialog);
enquiryPopUp.showAtLocation(popUpView, Gravity.CENTER, 0, 0);
我不明白我在做什么wrong.Please求助。
我的值 21 中有以下行 style.xml
<item name="android:fitsSystemWindows">true</item>
这就是我的问题。但是由于我解释的原因
我不能删除这一行
所以我在 PopupWindow 布局的每个视图中添加了 android:fitsSystemWindows="false"
。
呜呜呜!!!解决了。
这是 android L :
上的样子在果冻豆上它看起来像:
这里是布局xml文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:customfont="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:background="@color/black_bg_dialog"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_marginRight="30dp"
android:layout_marginLeft="30dp"
android:layout_centerInParent="true"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical"
android:background="@color/enquiry_bg">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/enquiry_text_top"
customfont:customTypeface="fonts/Roboto-Light.ttf"
android:text="@string/contact_us" />
<EditText
android:id="@+id/et_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/name"
android:ellipsize="end"
android:hint="@string/contact_hint_name"
android:inputType="text"
android:singleLine="true"
android:textColor="@color/enquiry_text"
android:layout_marginTop="20dp"
android:textColorHint="@color/enquiry_text_hint"
android:textSize="18sp" />
<EditText
android:id="@+id/et_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/email"
android:ellipsize="end"
android:hint="@string/contact_hint_email"
android:inputType="textEmailAddress"
android:singleLine="true"
android:textColor="@color/enquiry_text"
android:layout_marginTop="20dp"
android:textColorHint="@color/enquiry_text_hint"
android:textSize="18sp" />
<EditText
android:id="@+id/et_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/phonenumber"
android:ellipsize="end"
android:hint="@string/contact_hint_phone"
android:inputType="phone"
android:singleLine="true"
android:textColor="@color/enquiry_text"
android:layout_marginTop="20dp"
android:textColorHint="@color/enquiry_text_hint"
android:textSize="18sp" />
<FrameLayout
android:id="@+id/fl_send"
android:layout_width="match_parent"
android:background="@color/enquiry_send_bg"
android:layout_marginTop="20dp"
android:layout_gravity="center"
android:padding="10dp"
android:layout_height="wrap_content">
<TextView
android:id="@+id/btn_submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="20dp"
android:drawableRight="@drawable/sendbutton"
android:text="@string/contact_btn_submit"
android:textColor="@color/white"
android:layout_gravity="center"
android:gravity="center"
customfont:customTypeface="fonts/Roboto-Regular.ttf"
android:textSize="23sp" />
</FrameLayout>
</LinearLayout>
<RelativeLayout
android:id="@+id/rl_progress_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/loading_alpha"
android:visibility="gone">
<ImageView
android:id="@+id/iv_progress_icon"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
</RelativeLayout>
和弹出代码 window :
View popUpView = activity.getLayoutInflater().inflate(R.layout.dialog_contact_us, null);
enquiryPopUp = new PopupWindow(popUpView, RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT, true);
enquiryPopUp.setBackgroundDrawable(new BitmapDrawable(null, ""));
enquiryPopUp.setAnimationStyle(android.R.style.Animation_Dialog);
enquiryPopUp.showAtLocation(popUpView, Gravity.CENTER, 0, 0);
我不明白我在做什么wrong.Please求助。
我的值 21 中有以下行 style.xml
<item name="android:fitsSystemWindows">true</item>
这就是我的问题。但是由于我解释的原因
所以我在 PopupWindow 布局的每个视图中添加了 android:fitsSystemWindows="false"
。
呜呜呜!!!解决了。