Надеюсь, это поможет вам

создать простое рабочее PopupWindow, нам нужно сделать следующее:

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-код

LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 

PopupWindow pw = new PopupWindow(inflater.inflate(R.layout.popup_example, null, false),100,100, true);

pw.showAtLocation(this.findViewById(R.id.main), Gravity.CENTER, 0, 0);

Мое требование - мне нужно

<TEXTVIEW android:layout_height="wrap_content" android:layout_width="fill_parent" />

и

<BUTTON android:id="@+id/end_data_send_button" android:text="Cancel"/>

в моемpopup_example.xml, Как я могу обработать эти два компонента в моем коде Java?

Ответы на вопрос(7)

Ваш ответ на вопрос