无法在线性布局内部单击编辑文本,内部弹出 window

Unable to click edittext inside inside linear layout, inside pop up window

我有一个线性布局内的编辑文本。线性布局在 pop window.

当我 运行 应用程序时,我无法单击并输入编辑文本。

弹出代码 window 它在我片段的 onCreateView 中:

final Button makeoffer = (Button) view.findViewById(R.id.make_offer);
    makeoffer.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            LayoutInflater layoutInflater = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View popupView = layoutInflater.inflate(R.layout.offer_popup, null);
            final PopupWindow popupWindow = new PopupWindow(popupView,LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
            EditText mEditText = (EditText) popupView.findViewById(R.id.payment_field);
            popupView.clearFocus();
            mEditText.requestFocus();
            popupWindow.setFocusable(true);
            popupWindow.update();

            final Spinner spinner1 = (Spinner) popupView.findViewById(R.id.transaction_spinner);
            spinner1.setAdapter(new ArrayAdapter<CharSequence>(getActivity(), R.layout.support_simple_spinner_dropdown_item,getActivity().getResources().getTextArray(R.array.payment_list)));

            Button btnDismiss = (Button)popupView.findViewById(R.id.cancel2);
            btnDismiss.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    popupWindow.dismiss();
                }
            });
            popupWindow.showAtLocation(popupView, Gravity.NO_GRAVITY, 0, 0);
        }
    }); 

XML 弹出窗口的布局代码 window:

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:descendantFocusability="blocksDescendants"
android:layout_height="match_parent"
android:background="#BF000000">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:textColor="#FFFFFF"
    android:textSize="25sp"
    android:layout_marginTop="120dp"
    android:text="Make an Offer"/>

<LinearLayout
    android:layout_width="300dp"
    android:layout_height="60dp"
    android:orientation="horizontal"
    android:layout_marginLeft="40dp"
    android:layout_marginTop="20dp"
    android:layout_gravity="top|left"
    android:background="#FFFFFF"
    android:layout_marginBottom="20dp"
    android:descendantFocusability="blocksDescendants">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="top|left"
        android:textColor="#00ff00"
        android:paddingLeft="10dp"
        android:paddingTop="5dp"
        android:text="Your Offer: "/>



        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:textColor="#000000"
            android:textSize="18sp"
            android:paddingLeft="10dp"
            android:text="$"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:textSize="38sp"
        android:hint="Amount"
        android:id="@+id/payment_field"
        android:textColor="#000000"
        android:paddingLeft="5dp"
        android:background="#FFFFFF"
        android:layout_gravity="center_vertical"
        android:textColorHint="#000000"/>

    </LinearLayout>

<Spinner
    android:id="@+id/transaction_spinner"
    android:spinnerMode="dialog"
    android:layout_width="300dp"
    android:layout_height="50dp"
    android:popupBackground="#00688B"
    android:layout_marginBottom="15dp"
    android:layout_marginLeft="40dp"
    android:background="#FFFFFF"
    />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:textColor="#00ff00"
    android:layout_marginLeft="100dp"
    android:textSize="15sp"
    android:paddingLeft="10dp"
    android:layout_marginBottom="15dp"
    android:text="How does this work?"/>

<Button
    android:layout_width="300dp"
    android:layout_height="40dp"
    android:layout_marginLeft="40dp"
    android:layout_marginTop="10dp"
    android:background="#228b22"
    android:text="Review Offer"
    android:inputType="textFilter"
    android:id="@+id/review_offer"
    android:textColor="#FFFFFF"
    android:layout_marginBottom="10dp"
    />
<Button
    android:layout_width="300dp"
    android:layout_height="40dp"
    android:layout_marginLeft="40dp"
    android:layout_marginTop="10dp"
    android:background="#FFFFFF"
    android:text="Cancel"
    android:inputType="textFilter"
    android:id="@+id/cancel2"
    android:textColor="#000000"
    android:layout_marginBottom="10dp"
    />

对于阅读本文的其他人:

非常感谢@AnkiiRawat。 我所做的是删除了 xml 文件中的 android:descendantFocusability="blocksDescendants"。在包含 EditText 的 LinearLayout 中,我添加了 android:descendantFocusability="afterDescendants" 属性。