я хочу создать в моем приложении всплывающее окна ввести текстовое поле и КИ и отменить кнопки:андроид всплывающих окон
это мой код в MainActivity:
forgotPassword.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
View pview = inflater.inflate(R.layout.forgot_password_popup,(ViewGroup)findViewById(R.layout.login));
final PopupWindow pw = new PopupWindow(inflater.inflate(R.layout.forgot_password_popup,(ViewGroup)findViewById(R.layout.login)));
pw.showAtLocation(v, Gravity.LEFT,0,0);
pw.update(8,-70,150,270);
//if onclick written here, it gives null pointer exception.
Button okbtn=(Button)pview.findViewById(R.id.okbtn);
Button cancelbtn = (Button)pview.findViewById(R.id.cancelbtn);
final EditText emailText = (EditText) pview.findViewById(R.id.EmailText);
okbtn.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
try {
ParseUser.requestPasswordReset(emailText.getText().toString());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
cancelbtn.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
pw.dismiss();
}
});
}
});
и вот мой забыл password_popup не .xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="@+id/EmailText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:hint="Enter Email Address"
android:inputType="textEmailAddress"
android:password="true"
android:singleLine="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/okbtn"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="OK" />
<Button
android:id="@+id/cancelbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="Cancel" />
</LinearLayout>
</LinearLayout>
однако отрезали (я не могу видеть текстовое поле или кнопку отмены, а также, нет какого-либо фона для всплывающих окон (я хочу прозрачный фон)
, а также, я могу нажать на кнопку ОК, так что-то не так с моим кодом
я буду рад помочь
это то, как он выглядит:
http://img827.imageshack.us/img827/9545/capturehdv.png
thanks alot
http://developer.android.com/guide/topics/ui/dialogs.html –
спасибо, я буду смотреть на него, и, вы знаете, как создать его trasperanct? спасибо –
@AdirRahamim Попробуйте то, что я разместил.? – Pragnani