Doesn't work, I have the view that now is 30x30 pixels, but on the top left of the screen and my drawable gets cutted off. -- Luca Bedogni Freelance Web Developer http://www.lucabedogni.it
On Tue, Mar 23, 2010 at 3:11 AM, murali raju <[email protected]> wrote: > use h.setLayoutParams(new ViewGroup.LayoutParams( > 30,30)); > > On Mon, Mar 22, 2010 at 11:49 AM, Luca Bedogni <[email protected]> > wrote: >> >> Mmm, I investigated a bit and i think this is not the problem. I'm >> making a new object every time. >> Beside that, I noticed that the view added has the dimensions of the >> screen, and not 30 pixels as I want. How can I avoid that? >> >> Thanks >> -- >> Luca Bedogni >> Freelance Web Developer >> http://www.lucabedogni.it >> >> >> >> On Mon, Mar 22, 2010 at 4:04 AM, murali raju <[email protected]> wrote: >> > coz you are using the same view object to all the shapes. so only the >> > most >> > recently created view will have listener. use an arraylist and add the >> > view >> > to it when ever a shape is created. >> > and check which view is clicked by using view.isPressed(). >> > >> > >> > On Sun, Mar 21, 2010 at 1:26 AM, Luca Bedogni <[email protected]> >> > wrote: >> >> >> >> Hi >> >> I have the following code: >> >> >> >> int x = (int)Math.round(Math.random()*200); >> >> int y = (int)Math.round(Math.random()*300); >> >> >> >> View h = new CustomDrawableView(c,x,y); >> >> h.setLayoutParams(new ViewGroup.LayoutParams( >> >> ViewGroup.LayoutParams.WRAP_CONTENT, >> >> ViewGroup.LayoutParams.WRAP_CONTENT)); >> >> >> >> h.setOnClickListener(new OnClickListener() { >> >> >> >> �...@override >> >> public void onClick(View v) { >> >> // TODO Auto-generated method >> >> stub >> >> Log.d("VIEW",v.toString()); >> >> v.setVisibility(View.INVISIBLE); >> >> } >> >> >> >> }); >> >> >> >> inside an Handler, that create every 2 seconds a new ovalShape and add >> >> it to the Layout. >> >> Everything works fine, except for the clickListener. In fact, when i >> >> press one of my shapes on the screen, it will be made invisible only >> >> the last one, and not what I clicked. >> >> >> >> Am I missing something? >> >> -- >> >> Luca Bedogni >> >> Freelance Web Developer >> >> http://www.lucabedogni.it >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> >> Groups "Android Beginners" group. >> >> >> >> NEW! Try asking and tagging your question on Stack Overflow at >> >> http://stackoverflow.com/questions/tagged/android >> >> >> >> To unsubscribe from this group, send email to >> >> [email protected] >> >> For more options, visit this group at >> >> http://groups.google.com/group/android-beginners?hl=en >> >> >> >> To unsubscribe from this group, send email to >> >> android-beginners+unsubscribegooglegroups.com or reply to this email >> >> with >> >> the words "REMOVE ME" as the subject. >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups "Android Beginners" group. >> > >> > NEW! Try asking and tagging your question on Stack Overflow at >> > http://stackoverflow.com/questions/tagged/android >> > >> > To unsubscribe from this group, send email to >> > [email protected] >> > For more options, visit this group at >> > http://groups.google.com/group/android-beginners?hl=en >> > >> > To unsubscribe from this group, send email to >> > android-beginners+unsubscribegooglegroups.com or reply to this email >> > with >> > the words "REMOVE ME" as the subject. >> > >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Beginners" group. >> >> NEW! Try asking and tagging your question on Stack Overflow at >> http://stackoverflow.com/questions/tagged/android >> >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/android-beginners?hl=en >> >> To unsubscribe from this group, send email to >> android-beginners+unsubscribegooglegroups.com or reply to this email with >> the words "REMOVE ME" as the subject. > > -- > You received this message because you are subscribed to the Google > Groups "Android Beginners" group. > > NEW! Try asking and tagging your question on Stack Overflow at > http://stackoverflow.com/questions/tagged/android > > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-beginners?hl=en > > To unsubscribe from this group, send email to > android-beginners+unsubscribegooglegroups.com or reply to this email with > the words "REMOVE ME" as the subject. > -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en To unsubscribe from this group, send email to android-beginners+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

