Android 在popupwindow中膨胀类com.lamudi.phonefield.PhoneInputLayout时出错

Android 在popupwindow中膨胀类com.lamudi.phonefield.PhoneInputLayout时出错,android,xml,popupwindow,Android,Xml,Popupwindow,在我的android应用程序中,我使用compile('com.lamudi.phonefield:phone-field:0.1)。3@aar它将在活动布局上完美地工作。问题是它不会在弹出窗口中打开,因为我在xml布局方面遇到了错误 XML布局 <com.lamudi.phonefield.PhoneInputLayout android:id="@+id/phone_input_layout" android:layout_width=

在我的android应用程序中,我使用compile('com.lamudi.phonefield:phone-field:0.1)。3@aar它将在活动布局上完美地工作。问题是它不会在弹出窗口中打开,因为我在xml布局方面遇到了错误

XML布局

        <com.lamudi.phonefield.PhoneInputLayout
        android:id="@+id/phone_input_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

}

检查xml第84行,有些地方出错了,我在该行号@haxm上使用了phoneInputLayout元素,phoneInputLayout有问题,可能它不能与多个布局一起使用,或者它应该是其专利布局中的一个布局是的,我应用了您的解决方案我得到了一个xml布局,但当我单击下拉菜单时仍然存在一个问题我得到了android.view.WindowManager$BadTokenException:无法添加窗口--token android.view.ViewRootImpl$W@19f592f无效;您的活动正在进行吗?@HAXM
public class PopupActivity extends Activity {

private Context mContext;
private Activity mActivity;
private android.widget.PopupWindow mPopupWindow;
private LinearLayout mBirthdetail;

@RequiresApi(api = Build.VERSION_CODES.N)
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_popup);

    mContext = getApplicationContext();

    // Get the activity
    mActivity = PopupActivity.this;

    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);

    // Inflate the custom layout/view
    View customView = inflater.inflate(R.layout.raw_birthdate, null);

    mBirthdetail = (LinearLayout) findViewById(R.id.birth_detail);

    mPopupWindow = new android.widget.PopupWindow(
            customView,
            ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT
    );
    // mPopupWindow.setContentView(findViewById(R.id.demo));

    mPopupWindow.setAnimationStyle(R.style.PopupAnimation);


    if (Build.VERSION.SDK_INT >= 21) {
        mPopupWindow.setElevation(5.0f);
    }

    mPopupWindow.setFocusable(true);
    mPopupWindow.update();
    mPopupWindow.setOutsideTouchable(false);

    final PhoneInputLayout phoneInputLayout = (PhoneInputLayout) customView.findViewById(R.id.phone_input_layout);

    phoneInputLayout.setHint(R.string.phone_hint);

    phoneInputLayout.setDefaultCountry("DE");

    String phoneNumber = phoneInputLayout.getPhoneNumber();


    new Handler().postDelayed(new Runnable() {

        public void run() {
            mPopupWindow.showAtLocation(mBirthdetail, Gravity.CENTER, 0, 0);
        }

    }, 100L);
}

@Override
protected void onStop() {
    super.onStop();
    mPopupWindow.dismiss();
}