Last active
April 10, 2017 03:13
-
-
Save fnovoac/51c0a8837c6ce89230cd57c15fbc2b63 to your computer and use it in GitHub Desktop.
CustomDialogInputWithXML.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/custom_dialog_layout_design_user_input" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical" | |
android:padding="16dp"> | |
<TextView | |
android:id="@+id/dialogTitleCiudad" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="Dialog Title" | |
android:textAppearance="?android:attr/textAppearanceLarge" /> | |
<EditText | |
android:id="@+id/inputDialogCiudad" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:hint="Enter Something" | |
android:inputType="text" /> | |
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LayoutInflater layoutInflaterAndroid = LayoutInflater.from(this); | |
mView = layoutInflaterAndroid.inflate(R.layout.custom_dialog_input, null); | |
//aca podemos asignar un TextView a un control del layout (si lo declaramos a nivel de clase, podemos usarlo en otro lado) | |
tv_inputUser = (TextView) mView.findViewById(R.id.inputDialogNombre); | |
new AlertDialog.Builder(this) | |
.setView(mView) | |
.setCancelable(false) | |
.setPositiveButton("Grabar", this) // el Activity debe implementar DialogInterface.OnClickListener para capturar el Click | |
.setNegativeButton("Cancelar", this) // el Activity debe implementar DialogInterface.OnClickListener para capturar el Click | |
.create().show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment