dialogplus icon indicating copy to clipboard operation
dialogplus copied to clipboard

Layout items onClicks not working

Open ergunkocak opened this issue 8 years ago • 1 comments

Hello,

onClick attributes are not working in dialog hich i define in layout xml. Here is an example :

<ImageButton
                android:id="@+id/genderMaleButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/button_male"
                android:background="@color/transparent_color"
                android:onClick="selectMale"/>

selectMale method is defined in caller activity and it works if i embed layout xml contents into main layout xml.

King Regards

PS : i found that parent must be defined while inflating : http://stackoverflow.com/questions/5444516/inflated-layouts-buttons-onclick-listener-not-working i do not know if this is the solution but wanted to share if in any case it has any help

ergunkocak avatar Jul 28 '15 07:07 ergunkocak

Until fix release, if anyone had same problem can implement onclicklisteners manually after dialog initialization :

buttonMale = (ImageButton) findViewById(R.id.sexMaleButton);
            buttonMale.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    selectMale(view);
                }
            });

ergunkocak avatar Jul 28 '15 10:07 ergunkocak