Currently I'm working on a custom view that has to define specific dialog content depending on the place that is used:
main.xml
<com.example.MyView>
<TextView android:text="Hello from Dialog"/>
</com.example.MyView>
My MyView class inflates different layout:
public class MyView extends RelativeLayout {
public EntriesList(Context context) {
super(context);
inflate(context, R.layout.my_view, this);
}
public void openDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
// builder.setView();
// Set all children from `main.xml` - in this case `TextView`
builder.create().show();
}
}
my_view.xml contains a button that opens dialog:
<RelativeLayout>
<Button android:onClick="openDialog" />
</RelativeLayout>
How can I prevent from rendering TextView, grab it and push into the Dialog view ?
Aucun commentaire:
Enregistrer un commentaire